How do I get a form to remember the last value?

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

Guest

I have created a form to look up client records in two unrelated tables using
LName and FName fields. If a client is in both tables or only in the second
table, the records pop up after clicking the OK button twice. However, If the
client is only in the first table, after clicking OK twice, the name
disappears from the two unbound text boxes, and I have to type in the last
and first name again, click OK (names disappear again) type in the names a
second time and click OK in order to obtain the report. Is there a way to
make this form work with only one click and no extra typing?
 
I think we need more information. Is the Ok button generated by your
code? If not, what does the message say? How are you doing the lookups
in the tables? More details, please.
 
The tables are linked to the form with LName and FName fields criteria
expressions.

Here is the code related to the OK button:

Private Sub OK_Click()

If IsNull([LName]) Or IsNull([FName]) Then
MsgBox "You must enter both Last and First Names."
DoCmd.GoToControl "LName"
Else
Me.Visible = False
End If
End Sub
 
Sorry. I'm still don't get it. Your code indicates that if the user
entered both names, the form is made invisible. How does this button
have anything to do with values in a table?
 
Back
Top