Discussion Locked

Access97 - Linking field(s) in multiple

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am working on a set of data entry forms for multiple tables. I've choosen to create aswitchboard so that user can update selected table. All is great except that I can't link field(s) from one form to another form. With test trial,it seems thatI can't have the field link from one form to
another by using "=field.table" which means once I data entered a field in
form1, it will not automatically appears in form2. I would like to know if
there is another way besides using the subform (parent/child link). If
anyone has comments please, I would love hear from you. thank you.

7 replies

by netgod

There are a few ways to handle this. But since you say "I can't link field(s)", meaning you may have more than 1 field to link, I suggest using Form2 Public variables (property). You can have as many Public properties as you need. And it's SIMPLE toimplement! The only gotcha is that "form2" MUST BE LOADED, prior to passing the data.

Here's an example:

Form2 Code Module
-----------------
Option Explicit

Public PassData1 as string
Public PassData2 as string

Sub Form_Activate()
MyForm2Control1.Text = PassData1
MyForm2Control2.Text = PassData2
End Sub

Form1 Code Module
-----------------
Option Explicit

Sub Form_Load
'// open all the forms (hidden) that you will be passing data to.

DoCmd.OpenForm "form2", windowmode:=acHidden

End Sub

'// use whatever form or control event you want.
Sub Form_Unload
With Form2
.PassData1 = Me.MyForm1Control1.Text
.PassData2 = Me.MyForm1Control2.Text
.Visible = True
End With
End Sub

Hope this helps

Steve

by sujit

in the field properties of form2 "control source" select the form1's field name that you want to appear by useing EXPRESSION BUILDER. hope this will solve you problem.

by mickfranzen

hi

If it is just a case of
"once I data entered a field in
form1, it will not automatically appears in form2. "
The quickest way is the field in form1 that is updated run code something like

forms!formname.requery

This will make the data in form 2 update and appear as it should.
also try

forms!formname!fieldname.requery

Sould be faster and a little more precise however either will work.

This discussion is closed to new replies.