reference a value on a form from another form

ivonsurf123

Registered User.
Local time
Yesterday, 23:04
Joined
Dec 8, 2017
Messages
69
Hello,

I am trying to pass a value from one form (comboBox) to another form (ComboBox) where the value is on frm_BankHolidays and the combobox that I need to add that value from the other form is Based, the form name is frm_Register_New_Employee. I am not sure if I am using a wrong reference and /or the wrong event as well. Please help.


Code:
Private Sub Form_Load()
     Me.Based.RowSource = [Forms]![frm_BankHolidays]![cboCountry].[RecordSource]
   
End Sub
 
Hello,

I am trying to pass a value from one form (comboBox) to another form (ComboBox) where the value is on frm_BankHolidays and the combobox that I need to add that value from the other form is Based, the form name is frm_Register_New_Employee. I am not sure if I am using a wrong reference and /or the wrong event as well. Please help.

The first question is do you want to pass just the single selected value in the combobox or do you want to pass the whole list of items displayed in the combobox? I asked that question because that sort of what it looks like you are trying to do with your code...
 
What I want to do is everytime I enter a new value in cboCountry to also add it in the other field Based that is in the other form.
 
I don't think this is the particular answer to your particular question, and actually I'm not 100% sure I've got your question down Pat yet. But I thought you might like to have a look at some ideas on my blog here:-


http://www.niftyaccess.com/open-one-form-from-another-and-transfer-data/


which might be of interest to you regarding the process of transferring information from one form to another...

There's loads of different ways of doing it!
 
What I want to do is everytime I enter a new value in cboCountry to also add it in the other field Based that is in the other form.

But what I'm not clear on is "field Based" a field, (a text box) or is it a combo box?
 
Based is a ComboBox from the form that I want to add the value that I enter in the other ComboBox cboCountry which is in frm_BankHolidays
 
Last edited:
So are either or both or none of your combobox's bound or unbound? Bound means that the data displayed in the combobox is related to an underlying table.

Unbound means that the control in this case a combobox, but it could well be a text box or some other control. Being unbound means that it doesn't save any information anywhere, not directly anyway...
 
Sorry Just realize that Combobox Based is under a navigation Form as well
 
Your code refers to RowSource/RecordSource but you are asking for a field value. I am confused. Can you try again using data to show what you are trying to achieve.
 
Agree with everyone. What is unclear is if a user selects
"Germany" in cboCountry on frm_BankHoliday do you want to set the value of combobox "Based" to "Germany" or do you want to add it as a selection to the row source of combobox Based.

FYI. Forms have recordsources combos and listboxes have rowsources.
 
Hello Everyone,

Just figure our how to do it, just silly of me, I was complicated myself, sorry about that, all I just need to do is to reference the table BankHolidays in the property sheet (Data = Row Source) of the New Employee form and that was it. Thank you for all your help.
 

Users who are viewing this thread

Back
Top Bottom