Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

suggestion need for coding change

Status
Not open for further replies.

wwww

Technical User
Oct 1, 2002
3
EG
Hi again,

I got these code for searching surname in the database. The result is displayed in the data sheet view.

Private Sub GoBtnSurname_Click()
Dim LookforSurname As String
If IsNull(Me!FindSurname) Then
Beep
MsgBox "You Must Enter a Value in the Find Surname Field", [vbOKOnly]
DoCmd.GoToControl ("FindSurname")
Exit Sub
Else
DoCmd.OpenForm ("frmDatasheet")
LookforSurname = Me!FindSurname
DoCmd.GoToControl ("Surname")
DoCmd.RunCommand acCmdSortAscending
DoCmd.FindRecord LookforSurname, , , , , True
End If

While Screen.ActiveForm.Name = "frmDatasheet"
DoEvents
Wend

DoCmd.GoToControl "Case_Num"
DoCmd.RunCommand acCmdSortAscending
DoCmd.FindRecord Common.newCaseNum, acEntire, , acSearchAll, ,acCurrent, true

End Sub

Two things I want to change:
1. the search result should display on the top (first column) of the datasheet view, now it is on the bottom.
2. If no matched result, the msgbox show the information “ no match record with this surname”. Now just display the first record in the db.

thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top