booking subform...

quasimodo

Registered User.
Local time
Today, 22:13
Joined
Mar 5, 2003
Messages
33
i'm creating a hotel booking system.

I have a booking form, which has guest details on it, and that particular guests booking details as a subform.

I'm having a problem with the GuestID. Please have a look at the attached pic.
The control source for the main source is the Guest table. The subform is based on a query. the control source for the GuestID in the subform is a GuestID field in a Booking table.

How can i make it so the GuestID doesnt need to be typed into the subform, but will take the value from the main form, and plug that into the booking table. I would also like to have the GuestID not appear in the subform.

Any way to do this, but still have it plug the value into the booking table along with the other booking table?

Any help appreciated... Thanx in advance...
 

Attachments

  • booking_form.jpg
    booking_form.jpg
    48.7 KB · Views: 208
Set the Visible of the GuestID in the sub form to "No" and make the Default Value = [Forms]![NameofMainForm]![GuestID]


HTH
 
thanks...

but then the control source wouldnt be the GuestID record in the booking table, and as that needs to be present, an entry will not be able to be made in the booking table....

Anything else...?
 
1. In design mode, you can set both these field to "visible = No" in the format properties.
I assume that GuestID Is a autonumber field.

2. The issue really sounds like it comes down to relationships. The underlying tables should have at minimum the following fields:

Guest table:
GuestID

Bookings table:
BookingsID
GuestID

Go to Tools Relationships and add both these tables, and create a relationship by dragging the Guest.GuestID field to the Bookings.GuestID field. Tick the box for referential integrity (cascade update & cascade delete). You now have the relatioship defined.

Now use the wizzard to make the forms afresh (you could edit the existing one, but it's so easy to do it again) and access will automatically understand that these are related by guest ID and you won't have the data entry problems. Then just hide the fields as above.
 

Users who are viewing this thread

Back
Top Bottom