I have a form that allows the user to search my database and find data. The find works great and I am using a mainform for the listbox where the end-user wants to opt for drop-down or begin typing and have the information show-up because there are over 1000 possibilities. When they find what they want, the subform textboxes automaticallly fill in what is associated with that listbox selection. So now the update comes into play. The end-user notices that the month and frequency need to be changed because the program is going to run in a different month and have a different frequency. So, they click on the textbox and type in ongoing for the frequency and the month is going to be Jun to start. By doing this, the data is now updated in the main table. The problem is while I am testing this I do see the change but the ID for each item does not change.
Example: The frequency table has 12 frequencies all with a distinct ID for the primary key. The month table 12 months with a distinct ID for the primary key. These have a relationship to the maintable. So, if in the main table the frequency for what the end-user changed USED to be Frequency one-time and the month march, the ID would be 1 for freqID and 3 for MthID. When the end-user decides they need to update this information, they type in ongoing and then Jun and ongoing should change to freqID 2 and 6 for MthID, but it does not in the maintable. The data they entered changed but the primary key associated with their change did not. This is because I know I need an afterupdate event for that textbox that is changing and I do have the primary key fields for each table that are not visible to end-user because they would have no clue what they mean. So, I hid them and I can see them on design view.
I am just not sure how to code my afterupdate event. I am sure it has to be something like
Code:
private sub freq_afterupdate()
if a new frequency is selected then take the value of what is typed in and run a query on the table and put in the correct primary key value
I am just not entirely sure how to do it. My main form does have a query that connects the maintable to all the other tables in the database.