Text box

  • Thread starter Thread starter David
  • Start date Start date
D

David

I have a DocManager form with a field "MachineNum", this
is the primary key on that form. When I click a button I
want to open a different form (Revision form) that has a
field "MachineNum", which is the foreign key to the form
above. When the Revision form opens I want the foreign
key field "MachineNum" text box to have the text that is
currently in the "MachineNum" text box from the DocManager
form. If I haven't confused you and anyone knows how this
is done can u please tell me. Here is the code I have in
the On Load Revision form Property...

Me.MachineNum.Text = ...

I can't even think of how I would reference and get the
data from the previous forms MachineNum text box.

I am having a big brain fart, any help would be great.

Thanks Dave
 
David said:
I have a DocManager form with a field "MachineNum", this
is the primary key on that form. When I click a button I
want to open a different form (Revision form) that has a
field "MachineNum", which is the foreign key to the form
above. When the Revision form opens I want the foreign
key field "MachineNum" text box to have the text that is
currently in the "MachineNum" text box from the DocManager
form. If I haven't confused you and anyone knows how this
is done can u please tell me. Here is the code I have in
the On Load Revision form Property...

Me.MachineNum.Text = ...

I can't even think of how I would reference and get the
data from the previous forms MachineNum text box.

I am having a big brain fart, any help would be great.

Thanks Dave

Don't use the Text property for this; use the Value property. That's
the default property of a text box, so you don't actually have to even
name the property. It's probably also a good idea to check that the
DocManager form is open before you refer to it. I'd recommend code like
this:

If CurrentProject.AllForms("DocManager").IsLoaded Then
Me.MachineNum = Forms!DocManager!MachineNum
End If

Note: the AllForms collection and IsLoaded property were introduced with
Access 2000. If you're using Access 97, there's another way to find out
if the form is loaded.
 
Back
Top