How to refresh a form

  • Thread starter Thread starter Tony Williams
  • Start date Start date
T

Tony Williams

I have a form control that is a lookup based on data that is input into the
previous control. How do I get the data in the second control to appear as
soon as I have input data into the first control. I've tried me.refresh in
the on enter event but it doesn't seem to work?
Thanks
Tony
 
Tony

How does the second control "get" its value? (i.e., where/when is it set?)

Have you looked into Me.Repaint?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Jeff, the second control is a calculated control using a Dlookup expression
which is based on the first control here is the Dlookup fornula
=DLookUp("[txtfirstname]","[tblindividual]","[txtmemnumber]=Forms!frmMain!Subform1!frmfeesubform![txtmemnbr]")
& " " &
DLookUp("[txtsurname]","[tblindividual]","[txtmemnumber]=Forms!frmMain!Subform1!frmfeesubform![txtmemnbr]")

So as I input txtmemnbr, which is the first control, I want the
secondcontrol which is txtfullname and which has the Dlookup as its control
source to be automatically populared as I leave txtmemnbr
Hope I've explained that.
Cheers
tony
 
Check my response ... try Me.Repaint. .Refresh refreshes the record, and
your control is calculated, not bound.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Tony Williams said:
Jeff, the second control is a calculated control using a Dlookup
expression
which is based on the first control here is the Dlookup fornula
=DLookUp("[txtfirstname]","[tblindividual]","[txtmemnumber]=Forms!frmMain!Subform1!frmfeesubform![txtmemnbr]")
& " " &
DLookUp("[txtsurname]","[tblindividual]","[txtmemnumber]=Forms!frmMain!Subform1!frmfeesubform![txtmemnbr]")

So as I input txtmemnbr, which is the first control, I want the
secondcontrol which is txtfullname and which has the Dlookup as its
control
source to be automatically populared as I leave txtmemnbr
Hope I've explained that.
Cheers
tony

Jeff Boyce said:
Tony

How does the second control "get" its value? (i.e., where/when is it
set?)

Have you looked into Me.Repaint?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Try this:

Dim MemNbr as Long
MemNbr = Forms!frmMain!Subform1!frmfeesubform!txtmemnbr

In the AfterUpdate property of the first control, you would use:

Me.SecondControlName =
DLookUp("[txtfirstname]","[tblindividual]","[txtmemnumber]= " & MemNbr)
& " " &
DLookUp("[txtsurname]","[tblindividual]","[txtmemnumber]= " & MemNbr)

Depending on your purpose or end result, you might consider a combo box for
your first control which has Member Number, First Name, Last Name for its
record source. Then the Control Source of the unbound second control would be

= [FirstControlName].Column(1) & " " & [FirstControlName].Column(2)



Tony Williams said:
Jeff, the second control is a calculated control using a Dlookup expression
which is based on the first control here is the Dlookup fornula
=DLookUp("[txtfirstname]","[tblindividual]","[txtmemnumber]=Forms!frmMain!Subform1!frmfeesubform![txtmemnbr]")
& " " &
DLookUp("[txtsurname]","[tblindividual]","[txtmemnumber]=Forms!frmMain!Subform1!frmfeesubform![txtmemnbr]")

So as I input txtmemnbr, which is the first control, I want the
secondcontrol which is txtfullname and which has the Dlookup as its control
source to be automatically populared as I leave txtmemnbr
Hope I've explained that.
Cheers
tony

Jeff Boyce said:
Tony

How does the second control "get" its value? (i.e., where/when is it set?)

Have you looked into Me.Repaint?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top