hi,
ahm. well can someone help me in my project, it is a reservation system in a church, the problem is, I have to reserve the date that my client wants. I don't know what application I should use. At first, I use the calendar contol 6.0 but I don't know how to use it. by the way, the I'm using visual basic 6.0.

I hope someone can help me

thanks!

What exactly do you want to do with the calender control?
What database will you be using?
What kind of reservations?

What code do you have so far?

i'm sorry I forgot about that. well I am using vb6.0 and ms access. I am thinking that the calendar, when clicked will display the information of the reservation in the textboxes. it is a wedding reservation system.

so far, I haven't started coding it yet just this

Private Sub Command1_Click()
   
      Dim rsCheckReservations As New ADODB.Recordset 
 
      Dim holdSelectedDate As String 
   
      holdSelectedDate = Me.Calendar1.Month & "/" & Me.Calendar1.Day & "/" & Me.Calendar1.Year
   
      '.Month -> returns the month number
   
      '.Day -> returns the daynumber
   
      '.Year -> returns the year
  
       
  
      With rsCheckReservations
      If .State = adStateOpen Then .Close
 
     cn.Open ("SELECT * FROM tblReservations WHERE date='" & holdSelectedDate & "'")
      If .BOF And .EOF = True Then
  
      Else
       MsgBox "Date already reserve", vbOKOnly + vbExclamation, Me.Caption
       End If
 
      End With
       End Sub

another problem is the date is not updated. the date when i started using mscalendar control is the same date that I see in the system for the weeks.
hope you can help

Firstly, change the following -

Dim holdSelectedDate As String

holdSelectedDate = Me.Calendar1.Month & "/" & Me.Calendar1.Day & "/" & Me.Calendar1.Year

to

Dim holdSelectedDate As Date 'date
 
      holdSelectedDate = Calender1.Value 'Add this AFTER the user clicked "selected" a date from calender1.

Text1.Text = Format(holdSelectedDate, "yy/mm/dd")

To ensure that Calender1 (presuming you are using monthview as a control) shows the current date, set its ShowToday property to True.

You also might want to change your select statement to the following -

cn.Open ("SELECT * FROM tblReservations WHERE date = DateValue(" & "'" & holdSelectedDate & "'")

I have created a diary program for my wife that displays a calendar. When you click on a date it opens up a scrollable text box to enter diary or any type of text. If there is an entry for a particular date it changes the color of the date on the calendar so you will know there is an entry for that date. You could select a date and enter your reservation information instead of a diary entry. You can even print out the text for any entries on any month to give to the person requesting the reservation as a hard copy. the calendar is good into the year 2900+. That means you can make reservations years ahead of time and move the calendar back to the current date. I can send you the compiled program to use for your church. Just send me your email and I can forward it to you.

ok thanks johntech2001. I'll send you my email address right away. :)

I have sent the compiled program to you. Let me know how it works out for you!

John

This question has already been answered. Start a new discussion instead.