Passing values between forms

  • Thread starter Thread starter Audrey
  • Start date Start date
A

Audrey

Hi,

My main form holds a list of client, and on this form is a
button to search for existing clients. The search form
opens fine and finds the clients. What I'm trying to do
now is put a "Add to list" button on the search form so
the user can add the client he just found using the search
form to the list on the main form.

How can I be sure that the client is added to the right
project id?

I'm guessing I need to pass the project ID to my search
form so when I click "Add to list" I just add directly to
the table, but how can I pass this ID? Or is there a
better way to do this?

Thanks,
Audrey
 
Add the button to your "Search" form in design view.
Right-click on the button (in design view) and
select "build" then "Code Builder".
Enter something like this:

Forms!frmMain!Text1.SetFocus
Forms!frmMain!Text1.Text = XXX

Where frmMain is the name of your main form and
Text1.text is the target control and XXX is the value
you wish to pass.

If their selection is made from a list box ("List2")
try this:
Forms!frmMain!Text1.Text = List2
if it has more than 1 column
Forms!frmMain!Text1.Text = List2.Column(3)

Only problem doing it this way is that both forms must be
open.
 
Back
Top