hello out there,,i'm using vb6 and need to use calendar control. I managed to import the calendar using projects-->ms calendar and i've placed it on my form. Now i need to add the dates slected onto my MS-Access Database. How do i do that??

the summary::: i need guidelines,codes,functions that will help me add the date selected on my DB....thanks in advance

Recommended Answers

All 3 Replies

Time to use your frinds (yahoo, google, ask, answers, bing) and search for vb6 ado tutorial...

Good Luck

commented: don't you get tired of writing the same silly message every where -3
Member Avatar for StanM

Here is a VB6 routine I wrote some time ago I think does just what you want. It uses an ODBC connection to an Access database.

Private Sub Calendar1_Click()
    'Set the reminder date for this quote
    varDateYear = Calendar1.Year
    varDateMonth = Calendar1.Month
    varDateDay = Calendar1.Day
    varReminderDate = varDateMonth & "/" & varDateDay & "/" & varDateYear
        Set cn = CreateObject("ADODB.Connection") '***'
        Set rs = CreateObject("adodb.recordset")
        cn.Open "QuoteDB", "admin", ""

        strSQL = "UPDATE [Quotes] SET "
        strSQL = strSQL & "[Reminder] = #" & varReminderDate & "#"
        strSQL = strSQL & " WHERE [ID] = " & Form1.varQuoteID
        Set rs = cn.Execute(strSQL)
    MsgBox ("A reminder for this quote has been set for " & varReminderDate)
End Sub

Calendar1.value will return the date selected from the calendar, so you can add it your database by;
1. directly using adodc1.addnew, or
2. inserting the calendar value in a textbox that is connected to the adodc control.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.