I have used Access 97 a long time ago and was reasonably proficient, but my age is against me now. I have two tables:the first containing four fields and the other will have identical fields of the first table plus additional fields. I am trying to get combo box referencing the first(master table) automatically filling in four fields in the secondary table. If anybody is willing to point me in the right direction it would be much appreciated. I can post the basics of the database if required.
Thank you in advance
What are the primary keys and foreign keys to these tables?
Better post the other basics, it helps us help you
Basically, you have a combo box that needs to look in table A at four fields and when one is selected, it populates four different fields. You could use VBA to populate the four fields in an AfterUpdate event for the combo box.
VBA would be simple, something like the following (not 100% sure of the syntax right now):
Me.Fieldname1 = Me.ComboboxName.Column(0)
Me.Fieldname2 = Me.ComboboxName.Column(1)
Me.Fieldname3 = Me.ComboboxName.Column(2)
Me.Fieldname4 = Me.ComboboxName.Column(3)
Thanks for the replies. I have similar code, but I think there may be a problem with the field names being identical. I will rename the fields in the master table and see if that works. If still having no success, then I will post the file. It is pretty basic, but it will be developed from there.
Thanks once again.
I have given up,I must be missing something obvious.I have started from scratch and am posting the file. I have included the tables and the two basic forms. Any help would be appreciated.
Sorry to be harsh here, but what is it you expect us to do? Do you want us to write a book containing all the instructions on how to do what you want or do you want us to design your database for you?
I doubt anyone here would want to do either.
First YOU put in your attempt at achieving your goal, using the advice that is already in this topic and when you get stuck, then post your situation, where you are stuck, perhaps along with the database at the point where you are stuck and then it should be easy to help you.... AND you will learn how to do it better than someone just doing it for you.
* Create a combo box to select the code, with the 5 fields of the master file in the combo box.
* Look at post 3 and code your afterupdate for your combo box to populate the other 4 fields of the related table.
There should be nothing else to do once you have done that. If you get stuck, ask away, even post your database again.
I must apologise in not including the four lines of code. StarTrekker you were not being harsh, and it was my fault for not including my attempts. I have never asked someone to do anything for me, just to get the job done. Knowledge only comes from attempting, failing and learning from ones mistakes. My skills range from pc repair, pc support, electronics both repair and installation, machining wood and metal, plumbing, electrical installation, building construction, etc.I have included the completed and working code to show that it has been sorted. I will now add the rest of the bits and make the form(s) pretty.