Populating a field after adding a record to combo box when notonlist

pam0566

Registered User.
Local time
Today, 03:36
Joined
Jun 6, 2008
Messages
132
I am using Access 2007, and have some cascading combo boxes, that i would like to populate one of the fields after i add a new record. if you look at my form [frmvehicles] i have a cascading combo box for MAKE and MODEL. When you select a vehicle make, the combo box for models [cbomodel] only shows the models that correspond to that particular make. BUT i want to either use a button or a popup form, taht if a model isnt listed i can open frmmakemodel subform and add teh model to a table that is already filtered by the make that was selected. So far so good. NOW (and here comes the tricky part), i would like after i add teh model and close that form [frmmakemodel subform] i would like the Model i selected to be already showing on my Form [frmvehicles] in the Model field. I dont know WHY its so difficult. thanks to some assistance i have that working on the DEALERS combo box, (same form) and the submode. HELP!! if you could look at this and offer a suggestion as to what i am doing wrong i would be so grateful! Thanks! I am submitting a copy of my data base for review.. thanks so much
 

Attachments

Hi Pam,
Helping you helps me because it forces me to load ac2007 and use it. It would be nice if before you posted your db you did a Debug>Compile and fixed all of the errors first. It makes it a little cleaner. Thanks.
 
Hello again Pam,
Did you not like the code I put in the Load event of the frmDealer in the other thread?
 
wow does you guys ever use vba in access?

doing this is very simple use something like this code example... this is just a example

when you have the form open

open it and have a WITH statement like this
docmd.open form"form name"
with form
.formfields("name of the text box").result = me!text box/dropdown name on the current form
...
end sub
that quote is my own i dont take other peoples code

this way when you click the button the vba code runs and populates the form you open with the data on the current page

hope i was able to help... i need help sometimes too
 
hi.. yes i liked your code [rural guy :)] but i had figured that out a diff way in the meantime and didnt want to mess with something that worked .. .. this is all somewhat new to me.. the last time i did this was 10 yrs ago. THis is a new project, almost ready to re-vamp my old data base.. taht one scares me a little.. thanks for all your input!! and will do the debug/ compile and try to clean it up.. thx.
 
Air force coder --- do i put that code into the "on open" event? or on the other form Close event? or on activate event after it gets back to orig form?
 
to Rural guy: hm.. i had fixed my dealer page.. let me try that code on this one.. because what i did isnt working for the make model. thanks will let you know if it works too.
 
Pam,
You changed the code such that when the MessageBox appears asking about the new Dealer, it is not displaying the value the user typed in the ComboBox. I had also included code in the Dealer form to fill in the new Dealer Name the user typed in. I guess you didn't care for that feature.
 
Last edited:
Hi Rural Guy. THe code on dealer doesnt seem to want to work on the make model. i think its because of Make or model id's? What i want is for it to work like this?
1) person enters car... they select year make model. model isnt on list. (models correspond to make that was already selected.
2) Notonlist event pulls up the frmmakemodel subform which should allow me to add a model.. BUT i want only the models that correspond with that make to be listed.
3) close form with new model listed.
4) back on frmvehicles the new model we added is not only in the cbobox list but selected already.

what works for my submode and dealers combo boxes doesnt want to work with this particular field... its driving me crazy. I could use an "open form" command button but would like to use the not on list if possible... Any ideas? attaching a new db, but didnt debug compile yet.. this is a working one and not my original...
 

Attachments

hi rural guy. i just saw your previous post. i fixed the dealer thing on my original.. just might not have on this copy i am using to play with the model thing. I find that i need to work with diff copies labled.. otherwise i mess soemthing up and cant find out what i did. the dealer thing works great. .EXACTLY like its supposed to. not on list pulls up dealer form, enter dealer and upon closing form the dealer is just there ... i love it, and now want the make model to work the same way. i can only assume that its because of the make / model id's? that keeps it from working. i have played with it so many different ways.. maybe you see something i dont... but thanks for the dealer combo post.. i really like how streamlined that makes everything.. easier it is to use the less headaches i get when my people start to input data!
 
ok, u rock! comes up on BOTH forms. that is fantastic, when i grow up i want to be you :)!!!! thanks so much. can i ask you one thing.. where did you alter the events... so i can learn from this and not mess up... which did you change?
 
I changed the OnNotInList event of the source form and the OnLoad event of the destination form. You'll notice I passed two arguments to the latest form.
 
I changed the other NotInList events in the project so the MsgBox displays the entered data as well.
 
wow.. works GREAT. thanks. i see what changes you made.. and it works exactly how i envisioned.... if only everything in life were like that! thanks so much for your input!
 
ok, i have a dumb question, or am in some need of some more help. seems like stuff i wanted to do i have had to do several diff ways. on my FRMVEHICLES when i select a submodel, is there a way to havea it already populated in the submodelform? same wiht dealer, once i enter a dealer, not on list and i need to add, the form comes up, how can i make that field populated? on the frmdealer, the agent field works same way, how can i make that populate when the form pulls up (the agent i enter that isnt on the list)? i tried some of hte ways some of the others work, but nothing so car made it happen... so asking the guru!!
 

Attachments

Hi rural guy. 07/15 at 11:05 am you commented to me about me not using a code you gave me? i didnt see that exact one.. what was it named and what thread was it on? maybe that is my problem and i missed it!!!
 
hi mr. rural guy! ok i found your post on the other thread. YES! thanks, that fixes the population when opening the agent field and teh dealer field.. THANK YOU! Sorry i missed it! ok, the only prob is that it wont work with my submodel field...still playing with that. Also, since the model field you so wonderfully created comes all filled in, is there a way to have it close by itself? so it automates the process? thanks!
 

Attachments

Users who are viewing this thread

Back
Top Bottom