R
Rhett_Y
Hi all.. I was able to get my other question answered buy now I have a new
one..
I have the following tables and code:
I am using the following search function to search my database:
Private Sub cmdSearch2_Click()
Dim strLastName As String
Dim strSearch As String
'Check txtSearch for Null value or Nill Entry first.
If IsNull(Me![txtSearch2]) Or (Me![txtSearch2]) = "" Then
MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criterion!"
Me![txtSearch2].SetFocus
Exit Sub
End If
'Performs the search using value entered into txtSearch
'and evaluates this against values in strStudentID
DoCmd.ShowAllRecords
DoCmd.GoToControl ("LastName")
DoCmd.FindRecord Me!txtSearch2
LastName.SetFocus
strLastName = LastName.Text
txtSearch2.SetFocus
strSearch = txtSearch2.Text
'If matching record found sets focus in strStudentID and shows msgbox
'and clears search control
If strLastName = strSearch Then
'MsgBox "Match Found For: " & strSearch, , "Congratulations!"
LastName.SetFocus
'txtSearch = ""
'If value not found sets focus back to txtSearch and shows msgbox
Else
MsgBox "Match Not Found For: " & strSearch & " - Please Try
Again.", _
, "Invalid Search Criterion!"
txtSearch2.SetFocus
End If
End Sub
Which i got from here: http://www.databasedev.co.uk/text_search.html
Question #1
I have my own record counter setup at the bottom of the form via this:
Private Sub Form_Current()
'Inserts current record number and total number of records
Me.txtCurrent = Me.CurrentRecord
Me.RecordsetClone.MoveLast
Me.txtTotal = Me.RecordsetClone.RecordCount
End Sub
The bottom part is the counter. Is it possible with the way I have the
search code setup to do the following:
(I now have a lblbox next to the last name that shows me how many "johnson"
i have in the database) But what i want to do is have setup so that when the
person enters in johnson it lets them know they have 3 (for example). I have
the counter buttons at the bottom. What I would like to be able to do is
have it setup so when they push the next record botton it shows the next
johnson record... not the next record in the database... I thought by having
the table set to a-->z it would carry over onto the form..but it doesn't....
So how can I do this??
Thanks again
R~
one..
I have the following tables and code:
I am using the following search function to search my database:
Private Sub cmdSearch2_Click()
Dim strLastName As String
Dim strSearch As String
'Check txtSearch for Null value or Nill Entry first.
If IsNull(Me![txtSearch2]) Or (Me![txtSearch2]) = "" Then
MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criterion!"
Me![txtSearch2].SetFocus
Exit Sub
End If
'Performs the search using value entered into txtSearch
'and evaluates this against values in strStudentID
DoCmd.ShowAllRecords
DoCmd.GoToControl ("LastName")
DoCmd.FindRecord Me!txtSearch2
LastName.SetFocus
strLastName = LastName.Text
txtSearch2.SetFocus
strSearch = txtSearch2.Text
'If matching record found sets focus in strStudentID and shows msgbox
'and clears search control
If strLastName = strSearch Then
'MsgBox "Match Found For: " & strSearch, , "Congratulations!"
LastName.SetFocus
'txtSearch = ""
'If value not found sets focus back to txtSearch and shows msgbox
Else
MsgBox "Match Not Found For: " & strSearch & " - Please Try
Again.", _
, "Invalid Search Criterion!"
txtSearch2.SetFocus
End If
End Sub
Which i got from here: http://www.databasedev.co.uk/text_search.html
Question #1
I have my own record counter setup at the bottom of the form via this:
Private Sub Form_Current()
'Inserts current record number and total number of records
Me.txtCurrent = Me.CurrentRecord
Me.RecordsetClone.MoveLast
Me.txtTotal = Me.RecordsetClone.RecordCount
End Sub
The bottom part is the counter. Is it possible with the way I have the
search code setup to do the following:
(I now have a lblbox next to the last name that shows me how many "johnson"
i have in the database) But what i want to do is have setup so that when the
person enters in johnson it lets them know they have 3 (for example). I have
the counter buttons at the bottom. What I would like to be able to do is
have it setup so when they push the next record botton it shows the next
johnson record... not the next record in the database... I thought by having
the table set to a-->z it would carry over onto the form..but it doesn't....
So how can I do this??
Thanks again
R~