mich
Apr 28 2012, 12:27 PM
Dear all,
I have a form, which adds a booking to the booking table.
One of the parts of the form is a combo box - this allows you to choose an item from the enquiry table. I want this to put the enquiryID into the booking table. however, rather than it showing the enquiryID to the user, I have it so that it shows the name of the centre that made the enquiry (which makes more sense to the users).
This all works fine, but when you enter a new booking, no enquiryID is actually entered into the record in the booking table.
Help!
for the combo box, in the property sheet I have
row source: SELECT tblEnquiry.EnquiryID, Centre.[Centre Name] FROM Centre INNER JOIN tblEnquiry ON Centre.CentreID = tblEnquiry.CentreID ORDER BY Centre.[Centre Name];
row source type: table/query
bound column: 1
I'm not sure if you need more information to be able to help me?
Thanks
zocker
Apr 28 2012, 12:40 PM
Greetings!
Your Booking table should have an enquiry ID field into which the Enquiry ID will be received. Your form must have this field included. Your combo should be bound to this field. In order to hide the ID from your user, look at the columns of the combo, make the first column 0 wide.
BTW I have just posted a Bookings demo prog in our code archive.
Not quite sure where you're heading with this but the Enquiry Id might not be placed best in the Bookings table....
Post again for more help!
HTH
Zocker
mich
Apr 29 2012, 04:19 AM
QUOTE (zocker @ Apr 28 2012, 06:40 PM)

Your Booking table should have an enquiry ID field into which the Enquiry ID will be received. Your form must have this field included. Your combo should be bound to this field. In order to hide the ID from your user, look at the columns of the combo, make the first column 0 wide.
Zocker
Thanks very much for your help.
I thought that this is what I was doing.
The field into which the EnquiryID will be received is in the bookings table (it acts as a foreign key to an enquiries table)
How can I check that this is the field that the combo box is bound to?
mich
Apr 29 2012, 04:22 AM
In the form property sheet, the record source is 'booking'.
In the combo box property sheet, the control source is 'EnquiryID'
I presume that this means that the combo box is bound to the field EnquiryID in the booking table?
(sorry for my lack of experience!)
mich
Apr 29 2012, 04:30 AM
Ah!
I think the problem is a bit different to what I thought it was!
I think that my form is working fine.
I think the actual problem is in the way that I am displaying my bookings table?
Because the enquiry ID is just a reference number, in the bookings table, for the field that actually stores the enquiryID, instead of displaying the enquiryID, I want the bookings table to display the name of the centre that made the enquiry. So I want that field to use a lookup to find out the name of the centre and display that.
So - I think that the enquiryID is actually being stored properly in the booking table.
but I think that this is not properly being displayed as the centre name.
In the lookup, I have
Row source: SELECT Centre.CentreID, Centre.[Centre Name] FROM Centre ORDER BY Centre.[Centre Name];
bound column: 1
column count: 2
column widths: 0cm;4cm
mich
Apr 29 2012, 04:44 AM
I've noticed a problem in the way that I had done the lookup - I was using centreID, rather than enquiryID.
I've changed that, and I can get it to show the enquiryid, but not the centre name.
Hmmm.... maybe I had better repost this as a new question, seeing as it is a completely different problem to what I first thought it was!
my new row source for the lookup in the bookings table now is:
row source: SELECT tblEnquiry.EnquiryID, Centre.[Centre Name] FROM (Centre INNER JOIN tblEnquiry ON Centre.CentreID = tblEnquiry.CentreID) INNER JOIN Booking ON tblEnquiry.EnquiryID = Booking.EnquiryID;
mich
Apr 29 2012, 06:43 AM
Solved it!
Thanks for your help which got me thinking in the right direction!
zocker
Apr 29 2012, 09:38 AM
In the Properties of the Combo, look for Control Source, choose the correct field from its own drop down list. If the field is not on the form, you must add it.
HTH
Z
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.