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

6 Years
Discussion Span
Last Post by faroukmuhammad

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

Good Luck

Votes + Comments
don't you get tired of writing the same silly message every where

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.