Updating a field using combo boxes and command button

pam0566

Registered User.
Local time
Today, 08:54
Joined
Jun 6, 2008
Messages
132
I have a database in Access 2007. ON my form [frmvehicles] i have a combo box field for cboMAKE, once selected will allow the user to use another combo box cboModel. if an item is not available on the cbomodel, i have a button [add model] that will allow a user to open a subform [frmmakemodelsubform] to add the model. That all works fine. what i would like, and am having trouble is that once I add a new model, and close frmmakemodelsubform, i would like the frmvehicles to not only have requery'd itself and cbomodel is updated to reflect the model i added, but have that same model selected. Any help appreciated, i have spent hours on this and so far everything i do messes up my combo boxes working at all!! Thanks!
 

Attachments

dear

i made the same thing like u do

here what i do

create many combo boxes

cboMake - cboModel - cboYear

when select from cboMake like toyota - honda - bmw

the cnoModel reflect the models for this make

here the code i wrote

Option Compare Database
Private Sub cboMake_AfterUpdate()
On Error Resume Next
Select Case cboMake.Value
Case "Toyota"
cboModel.RowSource = "tblToyota"
Me.cboModel = vbNullString
Me.cboYears = vbNullString
Me.cboKilos = vbNullString
Me.cboTrans = vbNullString
Case "BMW"
cboModel.RowSource = "tblBMW"
Me.cboModel = vbNullString
Me.cboYears = vbNullString
Me.cboKilos = vbNullString
Me.cboTrans = vbNullString
End Select

End Sub


i hope it will help you
 
I was trying to do this without a bunch of tables for every make. what i have is one table with all the makes. one with make and model. I finally got it to where i select the Make cbomake, then the models shown in cbomodel are only those models filertered from the makemodel table. I click on the "add new model" button and get the models filtered as well, in edit /add mode (data sheet). i can add the model. the only thin is i have to add teh MakeID manually. (but i created a field next to it so i can see and know what it is), once i retype the makeid field on the makemodel table it works fine and populates my table. I then close the subform, go back to my form and have to manually select the model from cbomodel (but at least the model i just entered shows in there now.) i would like to avoid havin to retype the makeid in the subform, and have the model stay in the cbo box once i add it. but all in all its workable.
 

Users who are viewing this thread

Back
Top Bottom