Passing Data To A Variable

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

Guest

I have two Access questions and I hope someone will be able to assist me.

1- Can you pass data from a form to a variable, then close the form and open
a new form and use the value of the variable in the second form?

2- Can you save a report to a Microsoft Word document? Is there a way to do
it in VB?

Thanks in advance for your help
 
1. Create a module with a global variable, on the form after you update your
value make the global variable equal to your form's control value
GlobalVar=me.ControlName

2. You can use the output to command in the on click event of a button control
DoCmd.OutputTo acOutputReport, "MyReport", acFormatRTF, "FileName.doc"
this will actually create a rich format text, but is readable with word.
 
I see another poster has recommended a global variable. There are times when
a global variable is necessary, but it is seldom and rare. I would suggest
you consider using the OpenArgs property to open the second form from the
first form before closing the first form. This would be the best way to do
that.
 
1- Can you pass data from a form to a variable, then close the form
and open a new form and use the value of the variable in the second
form?

As a third method: open the form in acDialog mode, then make sure it is
hidden rather than unloaded when the user is finished with it. The calling
code can retrieve the value(s) from its controls or custom properties and
unload it from memory before calling the second form.

Hope that helps


Tim F
 
Back
Top