N
Niall
I have set up two command buttons on a Form (Access 2003).
One is a Find Button the other Displays a Report.
I have a simple database - One table. The Find Command Button searches all
fields in the database for the specified string.
The Report Button Displays a list of all Companies in the Database.
The Find Button works great on its own but displays an error if I select it
after I select the Report Button. the error is as follows
"A Macro set to one of the current field's properties failed because of an
error in a FindRecord action argument."
The code behind the Command Buttons is as follows:
***********
Private Sub FormSearch_Click()
On Error GoTo Err_FormSearch_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
DoCmd.FindRecord " ", acAnywhere, , acSearchAll, , acAll, True
Exit_FormSearch_Click:
Exit Sub
Err_FormSearch_Click:
MsgBox Err.Description
Resume Exit_FormSearch_Click
End Sub
Private Sub CompanyListButton_Click()
On Error GoTo Err_CompanyListButton_Click
Dim stDocName As String
stDocName = "Drug Delivery Company List"
DoCmd.OpenReport stDocName, acPreview
Exit_CompanyListButton_Click:
Exit Sub
Err_CompanyListButton_Click:
MsgBox Err.Description
Resume Exit_CompanyListButton_Click
End Sub
************
Any help would be much appreciated.
(I would also like to know how to clear the text entry field for the next
search. It currently retains the string entered for the last search).
--Niall
One is a Find Button the other Displays a Report.
I have a simple database - One table. The Find Command Button searches all
fields in the database for the specified string.
The Report Button Displays a list of all Companies in the Database.
The Find Button works great on its own but displays an error if I select it
after I select the Report Button. the error is as follows
"A Macro set to one of the current field's properties failed because of an
error in a FindRecord action argument."
The code behind the Command Buttons is as follows:
***********
Private Sub FormSearch_Click()
On Error GoTo Err_FormSearch_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
DoCmd.FindRecord " ", acAnywhere, , acSearchAll, , acAll, True
Exit_FormSearch_Click:
Exit Sub
Err_FormSearch_Click:
MsgBox Err.Description
Resume Exit_FormSearch_Click
End Sub
Private Sub CompanyListButton_Click()
On Error GoTo Err_CompanyListButton_Click
Dim stDocName As String
stDocName = "Drug Delivery Company List"
DoCmd.OpenReport stDocName, acPreview
Exit_CompanyListButton_Click:
Exit Sub
Err_CompanyListButton_Click:
MsgBox Err.Description
Resume Exit_CompanyListButton_Click
End Sub
************
Any help would be much appreciated.
(I would also like to know how to clear the text entry field for the next
search. It currently retains the string entered for the last search).
--Niall