Check Boxes and Visibility Grr... (Access 2000)

BlueChicken

Usually Confused
Local time
Today, 13:59
Joined
Jun 19, 2009
Messages
88
Ok... I am making a database with four forms that record details about changes and new bookings different from our original schedule that we make for hotel bookings, rental car bookings, taxi/limo bookings, and airline ticket bookings.

Each form has 3 check boxes:

  • Is this booking new?
  • Was this booking changed?
  • Was this booking cancelled?
The 'Is this booking new?' is only for reporting purposes - letting us know this booking was not on the schedule for that month

The 'Was this booking changed?' check box makes all the text boxes for changed information show.

The 'Was this booking canceled?' check box makes the reason check box show.

This all works perfectly... but only for one record, any more than that and the problem arises.

I can check the text boxes on the first record and have the text boxes appear on that single record but when I add a new record the text boxes are still visible when they should not be.

Here is my code (The only changes between each form are the names):
Code:
Option Compare Database

Private Sub CanceledHotel_Click()
    Me.CancelHotelReason.Visible = Me.CanceledHotel
    Me.BXCancel.Visible = Me.CanceledHotel
End Sub

Private Sub ChangedHotel_Click()
    Me.ChangedHotelReason.Visible = Me.ChangedHotel
    Me.NewHotelName.Visible = Me.ChangedHotel
    Me.NewHotelCheckInDate.Visible = Me.ChangedHotel
    Me.NewHotelCheckInTime.Visible = Me.ChangedHotel
    Me.NewHotelCheckOutDate.Visible = Me.ChangedHotel
    Me.NewHotelCheckOutTime.Visible = Me.ChangedHotel
    Me.NewConfirmation.Visible = Me.ChangedHotel
    Me.BXChanges.Visible = Me.ChangedHotel
End Sub
Private Sub RecordSearch_Click()
On Error GoTo Err_RecordSearch_Click


    Screen.PreviousControl.SetFocus
    DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_RecordSearch_Click:
    Exit Sub

Err_RecordSearch_Click:
    MsgBox Err.Description
    Resume Exit_RecordSearch_Click
    
End Sub
 
Are the checkboxes bound to a field or are they unbound?
 
Call ChangedHotel_Click in the form's On Current event too:

Code:
Private Sub Form_Current()
   Call ChangedHotel_Click
End Sub

that way it will do the check when you move from record to record.
 
Call ChangedHotel_Click in the form's On Current event too:

Code:
Private Sub Form_Current()
   Call ChangedHotel_Click
End Sub
that way it will do the check when you move from record to record.

Does that mean I should add this:
Code:
Private Sub From_Current()
   Call ChangedHotel_Click
   Call CanceledHotel_Click
End Sub
Both are check boxes that are causing the problem.
 
Last edited:
Does that mean I should add this:
Code:
Private Sub [COLOR="Red"]From[/COLOR]_Current()
   Call ChangedHotel_Click
   Call CanceledHotel_Click
End Sub
Both are check boxes that are causing the problem.

Gotta spell the word FORM correctly - (not FROM)
 
Gotta spell the word FORM correctly - (not FROM)

OK... it is official. I have been out of school for far too long! Thank you! I can't believe I mistyped that :o You are right and it is working now. I will add the code to the other forms as well.
 
OK... it is official. I have been out of school for far too long! Thank you! I can't believe I mistyped that :o You are right and it is working now. I will add the code to the other forms as well.

No worries - I think we've all done something of the sort at one time or another :)
 

Users who are viewing this thread

Back
Top Bottom