Passing Arguements

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

Guest

I need some help in passing numeric data from a textbox and textual data from
a form ( the text data) that has a subform textbox (numeric data) to one
other new form when I open the new form. I plan on using the cmd.OpenForm
"FormName", That's as far as I get. Have spent
90 minutes reeading help files and am just as lost as when I started. Can
this even be done? Hope I explained what I am trying to do well enough to get
some feedback.
Bart

PS This is the second time I have posted this problem. The first time I
erred by forgetting to state the info about the subform. Even with that
stupid error on my part I got feed back that allowed me to pass the data from
the main form successfully. Have spent the last 2-1/2 hours trying to get the
second part to work. Just keep getting the same error telling me Access
cannot find the subform (it's name). Sure hope you guys know if this is even
possible. Has to be a work around someway, else many, many hours of coding go
bye, bye:(

Bart
 
You can do this....once you type....

docmd.open "formname"

then type.....

form_form2.textbox.text = form_form1.textbox.text (form2 being the form
where you want the text passed to....form1 is the original form where the
text is being passed from. Only replace the "form1", "form2" and "textbox"
parts of the phrase. Leave the "form_")

then for the subform I believe it's......

form_form2.textbox.text = form_form1.subform.form!textbox

This should work...let me now if it doesn't. I've used generic names
(obviously) for your forms.
 
Thank yoy Joey. It id after 1 am right now so will wait until thr morning to
give it a try. If I fail, I will reply to this post again with the full code
I have written. Hope I don't have to do this as it will be somewhat lengthy.
If I get it work, I'll reply also, but with a big high five! Muvh thanks,
Bart
 
The correct syntax for referring to a control on a subform is:

Forms!FormName!SubformName.Form!TextBoxName

or in code you can also use:

Me!SubformName.Form!TextBoxName

Be sure to use square brackets around names with spaces in them, like:

[Form Name]

You can use the default value property of the control in the new form to
read the value from the first form like:

=Forms!FormName!SubformName.Form!TextBoxName
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 

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

Back
Top