getting value from one form into a combobox on another

rainman89

I cant find the any key..
Local time
Today, 03:59
Joined
Feb 12, 2007
Messages
3,013
Hi all,
this isnt a huge problem, but it can be a pain in the azz sometimes. i ahve a form where a user can select from 2 cbos either the subject or the client.

if the client or subject is not in the list, they click a button to open an add form. what i want is when that form is closed. the cbo on the other form to automatically go to the newest record.

guide me oh wise ones!!
 
Ray,

Right after you add the new row to the table:

Forms!YourMainForm!cboYourCombo.Requery
Forms!YourMainForm!cboYourCombo = NewData

Wayne
 
Alright.
gave it a try.
didnt go through.
i put it in the onclick event of my save button on my add client form. was that not the right place?
 
Rainman,

.Requery refers to controls that are based on queries, did you simply create your combos based on the tables themselves?? If you did, you don't need to requery anything. Maybe you could write a SUB in the VB editor using the "GoToRecord" command on the "GotFocus" event of the combo, or maybe the "OnClose" event for the Add Client form??
 
Last edited:
Rainman,

.Requery refers to controls that are based on queries, did you simply create your combos based on the tables themselves?? If you did, you don't need to requery anything. Maybe you could write a SUB in the VB editor using the "GoToRecord" command on the "GotFocus" event of the combo, or maybe the "OnClose" event for the Add Client form??

combos are based on queries, i did do a gotorecord in the onclose of the add form, but i couldnt get it to work. says cbos dont support gotorecords....
 
this sounds a bit like a problem i was struggling with recently. As I understand it, you're unable to link off of information added in a new record, as there is no open record in the addform. I got around it, by always keeping a "blank" record, which I would then add the information to when adding a new record (it then creates a new blank). Since my "add" form now has an actual record open, it is able to pass on the information within.

maybe this helps?
 
Didnt think about trying it this way.

ill give it a go. Thanks
 
Rainman,

this is a small sample slopped together to show how a GoToRecord record command can be used with combo boxes via single-step macros. It might help you figure things out...
 
Last edited:

Users who are viewing this thread

Back
Top Bottom