954,582 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

calendar control in vb6

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

venkatnams
Newbie Poster
21 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

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

Good Luck

vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296
 

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)
        cn.Close
    '=====================
    
    MsgBox ("A reminder for this quote has been set for " & varReminderDate)
End Sub
StanM
Newbie Poster
1 post since Jul 2011
Reputation Points: 10
Solved Threads: 0
 

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.

faroukmuhammad
Junior Poster
140 posts since Sep 2008
Reputation Points: 20
Solved Threads: 16
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: