HELP!? Forms/Subforms help

  • Thread starter Phlipper via AccessMonster.com
  • Start date
P

Phlipper via AccessMonster.com

Hi,

I have an app with various forms with various subforms that can be all called
from each other. I am using customer names on each of the forms. When I hit a
button to open a subform, I would like to pass the customer name from the
[Name] field in the original form to the subform being opened (I have some
very computer illiterate people here who cannot handle ensuring that the name
is input correctly each time).

Is there a function I can create that will always take the data from the
current form and pass it to whichever new form is being opened?

Thank in advance

Frustrated Newb Phil
 
B

bymarce

If you're opening the form with DoCmd.OpenForm you can use the [OpenArgs]
criteria to pass the customer name.
Marcie
 
P

Phlipper via AccessMonster.com

Hi, thanks. I'd tried that a few times, but I couldn't seem to get it to work.
I had various error messages (as I played around with it), the most common
being that the data type was wrong - but no matter what I tried I couldn't
get it to work. Maybe my syntax was wrong or something (1st programming I've
ever done).
If you're opening the form with DoCmd.OpenForm you can use the [OpenArgs]
criteria to pass the customer name.
Marcie
[quoted text clipped - 11 lines]
Frustrated Newb Phil
 
B

bymarce

Try this substituting your subform name for "frmSubForm" and the name of your
control for the customer name in "txtCustomerName".

Private Sub cmdButton_Click(NewData As String)
DoCmd.OpenForm "frmSubForm", acNormal, , "[txtCustomerName]='" & NewData &
"'", acFormEdit, acDialog
End Sub

Phlipper via AccessMonster.com said:
Hi, thanks. I'd tried that a few times, but I couldn't seem to get it to work.
I had various error messages (as I played around with it), the most common
being that the data type was wrong - but no matter what I tried I couldn't
get it to work. Maybe my syntax was wrong or something (1st programming I've
ever done).
If you're opening the form with DoCmd.OpenForm you can use the [OpenArgs]
criteria to pass the customer name.
Marcie
[quoted text clipped - 11 lines]
Frustrated Newb Phil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top