i have a tab control set up on my main form and on one tab i have it set up to add records, on another tab i have a subform on it linked to my search form, and another tab with a subform linked to my edit form.
previously i just had all the forms separate and i was able to set up an edit button on my search form which used this code to open my edit form with the record that i had selected (this code worked);
DoCmd.OpenForm "frmEdit", acNormal, , "[AssetID]=" & Me!AssetID
i didn't like it opening a bunch of different windows all the time, so i combined the forms into one form with the tab control, but now i can't get my edit button to work. depending on the codes i've tried, it either comes up with an error, or will actuall open my frmEdit tab and just place the very first record in it to be edited instead of the one i want to edit. here is the code i currently have that does not work;
DoCmd.GoToControl "tabEdit"
DoCmd.GoToRecord , , acGoTo, "[AssetID]=" & Me!AssetID
all the searches i've done for GoToRecord gives me codes that are similar to my first code which opens up a different form and doesn't work the way i'm wanting it to.
my main form is frmAssets. the tab control is named tabControl, and the individual tabs on that are tabAssests, tabSearch, and tabEdit. the subforms are called frmSearch and frmEdit, which is the same names as the actual forms that they're linked to. how can i get my edit button to open tabEdit and display the record i have chosen from my frmSearch in the tabSearch tab?
here's a watered down version of my db that shows what i have set up for it.
previously i just had all the forms separate and i was able to set up an edit button on my search form which used this code to open my edit form with the record that i had selected (this code worked);
DoCmd.OpenForm "frmEdit", acNormal, , "[AssetID]=" & Me!AssetID
i didn't like it opening a bunch of different windows all the time, so i combined the forms into one form with the tab control, but now i can't get my edit button to work. depending on the codes i've tried, it either comes up with an error, or will actuall open my frmEdit tab and just place the very first record in it to be edited instead of the one i want to edit. here is the code i currently have that does not work;
DoCmd.GoToControl "tabEdit"
DoCmd.GoToRecord , , acGoTo, "[AssetID]=" & Me!AssetID
all the searches i've done for GoToRecord gives me codes that are similar to my first code which opens up a different form and doesn't work the way i'm wanting it to.
my main form is frmAssets. the tab control is named tabControl, and the individual tabs on that are tabAssests, tabSearch, and tabEdit. the subforms are called frmSearch and frmEdit, which is the same names as the actual forms that they're linked to. how can i get my edit button to open tabEdit and display the record i have chosen from my frmSearch in the tabSearch tab?
here's a watered down version of my db that shows what i have set up for it.