A
Afrosheen via AccessMonster.com
I have a form called subFrmFind which is a sub form of frmrostersub1. There
is a last name on both forms and has no links attached. All you do is enter
the last name of the person you're looking for and the fields are populated
with the information on the person. Last name, first name, and what
department they work in. The user can not change any information. It's just
for display purposes and to make sure you have the correct person. if not,
then you can click on the Next button until you find the person your looking
for. This is the code:
Private Sub txtSearch_AfterUpdate()
Dim lNameRef, stwhere, strSearch, strWhere As String
10 If IsNull(Me![txtSearch]) Or (Me![txtSearch]) = "" Then
20 MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criterion!
"
30 Me![txtSearch].SetFocus
40 Exit Sub
50 End If
'---------------------------------------------------------------
'Performs the search using value entered into txtSearch and evaluates
this against values in lName
60 DoCmd.GoToControl ("lname")
70 DoCmd.FindRecord txtSearch
80 lNameRef = LName.Text
90 txtSearch.SetFocus
100 strSearch = txtSearch.Text
110 If lNameRef = strSearch Then
'MsgBox "Match Found For: " & strSearch, , "Congratulations!"
LName.SetFocus
140 txtSearch = ""
150 Else
160 Call MsgBox("Match Not Found For: " & strSearch _
& vbCrLf & "" _
& vbCrLf & "Please Try Again.." _
, vbExclamation, Application.Name)
170 txtSearch = ""
180 txtSearch.SetFocus
190 End If
End Sub
What I want to do is after the person is found, I want the main form
[frmrostersub1] to display/lookup/search the information when I hide the form.
I've tried setting the focus on the the main form then
DoCmd.GoToControl ("lname")
DoCmd.FindRecord txtSearch
but that didn't do any thing.
Your help would be most appreciated. Thank you.
is a last name on both forms and has no links attached. All you do is enter
the last name of the person you're looking for and the fields are populated
with the information on the person. Last name, first name, and what
department they work in. The user can not change any information. It's just
for display purposes and to make sure you have the correct person. if not,
then you can click on the Next button until you find the person your looking
for. This is the code:
Private Sub txtSearch_AfterUpdate()
Dim lNameRef, stwhere, strSearch, strWhere As String
10 If IsNull(Me![txtSearch]) Or (Me![txtSearch]) = "" Then
20 MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criterion!
"
30 Me![txtSearch].SetFocus
40 Exit Sub
50 End If
'---------------------------------------------------------------
'Performs the search using value entered into txtSearch and evaluates
this against values in lName
60 DoCmd.GoToControl ("lname")
70 DoCmd.FindRecord txtSearch
80 lNameRef = LName.Text
90 txtSearch.SetFocus
100 strSearch = txtSearch.Text
110 If lNameRef = strSearch Then
'MsgBox "Match Found For: " & strSearch, , "Congratulations!"
LName.SetFocus
140 txtSearch = ""
150 Else
160 Call MsgBox("Match Not Found For: " & strSearch _
& vbCrLf & "" _
& vbCrLf & "Please Try Again.." _
, vbExclamation, Application.Name)
170 txtSearch = ""
180 txtSearch.SetFocus
190 End If
End Sub
What I want to do is after the person is found, I want the main form
[frmrostersub1] to display/lookup/search the information when I hide the form.
I've tried setting the focus on the the main form then
DoCmd.GoToControl ("lname")
DoCmd.FindRecord txtSearch
but that didn't do any thing.
Your help would be most appreciated. Thank you.