Link to home
Start Free TrialLog in
Avatar of salival
salival

asked on

need some more simple VB code for an access form

I have a combo box set up with the standard code in the 'on not found' event to open up another form so the user can fill out that form, and then goes back and requeries the combo box.

I dont like the fact that when the user types in his value in the combo box, he/she has to retype the exact same value for the related field in the new box.  I need it to send the value the user typed to the new text box in the new form.

Thanks.
SOLUTION
Avatar of gillgates
gillgates

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of salival
salival

ASKER

i added the code, and i get an error message when loading the new form telling me 'variable not defined' and it highlights the "frmMain" name in my code
Replace "frmMain" with the name of your main form, it's set to Form1 by default.
If you can't get that working you could always save it in a global variable and then on form_load of your new form just set the textbox.Text to that variable.
Avatar of salival

ASKER

yeah, i changed the name (im not that clueless).  Have no clue why it wouldnt be working.    The original form that is calling the second form is a subform within another form, but i dont think that has anything to do with it.
This will work:

From your calling form:

Form2.Text1.Text = Me.Combo1.Text
Form2.Show


where Form2 is the new form to be shown
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of salival

ASKER

sorry guys.  i had to take some time away from it and move onto something else.

the trick is, at least in access 97, it has to be Forms!frmMain.text
You don't have to worry about referencing the form (except to launch it) if you use the OpenArgs method I showed above.