transferring data between forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am a newbie and I am trying to transfer data from one form to the next.
What I am actually trying to do is transfer values in a list box including
what is hightlighted to a list box on a different form. Is there a way to do
this?

Thanks in advance
 
Hi,

I am a newbie and I am trying to transfer data from one form to the next.
What I am actually trying to do is transfer values in a list box including
what is hightlighted to a list box on a different form. Is there a way to do
this?

Thanks in advance

From a List Box? MultiSelect is None? Simple? Extended?

I'll guess it's set to none (only one item can be selected).
Are you opening the second form?
Use the OpenArgs argument to pass the value:

DoCmd.OpenForm "FormName", , , , , , Me.ListBoxName

then use the Load event in the second form to read the OpenArgs and
set the value of it's list box:

If Not IsNull(Me.OpenArgs) Then
Me!ListBoxName = Me.OpenArgs
End If


The other form is already open?
Use code in the first form to set the list box value in the second
form:
forms!SecondFormName!ListBoxName = Me.ListBoxName

If the List Box is set to multi-select, then you need to cycle through
the list box and read each item selected.
There is some code to do this in VBA help.
 
Back
Top