display a field from another form

  • Thread starter Thread starter SylvieB
  • Start date Start date
S

SylvieB

I have two forms. Let’s say Form1 and Form2. I need to write a code that when
the user puts a checkmark on the box in Form1, it displays “record closed†on
form2. The field on form2 is Record. It is a text box. My code does not work.
I am not sure how to call a field from a different form.
Here is the code I have so far:
Private Sub chkClose_AfterUpdate()
If Me!chkClose = True Then
Form_from2.Record = “record closedâ€
Else
Me!txtClose = Null
Me.Dirty = True
End Sub
Thanks in advance for any help.
 
First, you need to check if the form2 is loaded:

If Application.CurrentProject.AllForms!form2.IsLoaded Then
If Me!chkClose = True Then
Forms!form2!Record = "Record Closed"
End If
end if

Also, I would consider re-naming the textbox "record" to perhaps
"txtRecord".

Damon
 
The correct syntax is [Forms]![form-name].[control-name] =
Of course, this will only work if the form is open.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
Back
Top