Dec 5 2005, 02:53 PM
I have created tblPost with fields Post_city and Post_Number. I have entered all the citys of one region and numbers of this citys. On one of the forms i created that you can select form a combo box an city , and in other field you can see the number of that city --> this is part of tblCompany. When i do this i can see the selected city ( so the city is written in to the tblCompany ), but problem is that because the field of a post number is only sourcing from combo box and result can not be written in to tblCompany. Everything is ok when you are only checking company from form and you can see a city and an post nuber as well, but he problem is when i am trying to use an entry from tblCompany and there is only city and no post number. How i could tell the field with an post offce nuber to not only show it when you select city from combo box, but as well write it in to proper field in tblcompany?
Dec 5 2005, 03:14 PM
You table should look like this:
PostID (PK and auto)
In your tblCustomer you only need to save PostID not the PostCity or PostNumber (I assume that PostNumber is unique for each City). Using a query you can join tblCompany and tblPost so that you can see the actual PostCity and PostNumber for each company.
I hope I understood what you are trying to do...
Dec 5 2005, 03:15 PM
Yes, it will take a touch of code to do this. The simplest way is to bind the post office number text box to the appropriate field in tblCompany. Then, in the properties of the city combo box, click the Event tab, the After Update event row, the ... at the end of the row. Pick Code Builder from the list that appears.
Me.[PostOfficeNumberTextBoxNameGoesHere] = Me.[ComboBoxNameGoesHere].Columns(1)
Now each time the combo box for city is updated, the text box holding the post office number will be updated. Since the text box is bound to the table, the field in the table will also be updated.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here