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
another textbox on thr same form to another form when I open the new form. I
plan on using DoCmd.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
 
Assuming the following object names in my example below:

First form: Form1
Textbox on first form: txtbox1
Second form: Form2
Textbox on second form: txtbox8

Sample code (in first form's module:)

strForm = "Form2"
Docmd.OpenForm strForm
Forms(strForm)!txtbox8 = Me.txtbox1

Sample code (in any module:)

strForm1 = "Form1"
strForm2 = "Form2"
Docmd.OpenForm strForm2
Forms(strForm2)!txtbox8 = Forms(strForm1)!txtbox1

Note: the data type (text or numeric) does not affect the syntax in this
case.

HTH,
Nikos
 
Nikos, thank for your help! The first parts works perfectly. The problem is
I mistakenly gave you incomplete information. The second bit of data from the
tectbox you refered to as txtbox8 is not on the same form as the first one!
The second textbox is located in a subform within the origional form. My
fault, I just didn't notice where the second text was located. Have tried
several possible solutions based on the second part of your original
solution. Alas, to no avail:(. A bit more help would be appreciated.
Bart
 
Bart,

Assuming the subform is named SubForm4, the example code would be
modified to:

strForm = "Form2"
strSubForm = "SubForm4"
Docmd.OpenForm strForm
Forms(strForm).controls(strSubForm).Form.Controls("txtbox8)" = Me.txtbox1

(watch out for wrapping in your newsreader, the last expression is all
in one line!)

HTH,
Nikos
 

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