bobbobruns12
asked on
Open Finder with command Button
We are trying to input data for a Real estate database where you input City and State into a form and certain processes take place. However we are inputing hand written data from a person with awful handwriting and we need a way to search our city table to see related cities and towns. We want a command button that when clicked will bring up the Find Menu set to that table. Any ideas would help a lot.
ASKER
Private Sub FindCitycmd_Click()
On Error GoTo Err_FindCitycmd_Click
Screen.PreviousControl.Set Focus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_FindCitycmd_Click:
Exit Sub
Err_FindCitycmd_Click:
MsgBox Err.Description
Resume Exit_FindCitycmd_Click
End Sub
Yeah thats the code from the Find record button. Unfortunately it doesnt do anything. It just says "the expression you entered refers to an object that is closed or doesnt exist"
On Error GoTo Err_FindCitycmd_Click
Screen.PreviousControl.Set
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_FindCitycmd_Click:
Exit Sub
Err_FindCitycmd_Click:
MsgBox Err.Description
Resume Exit_FindCitycmd_Click
End Sub
Yeah thats the code from the Find record button. Unfortunately it doesnt do anything. It just says "the expression you entered refers to an object that is closed or doesnt exist"
Are you trying to search the Form's recordset or a different recordset that gets modified on a command from the form?
ASKER
I'm trying to search a table that is somewhat unrelated to the form. It is a table that we use to look up zipcodes and counties when the user enters a city and state combo. It isnt used to contain the records for the form, simply a lookup for the form.
you can use
Private Sub cmdFind_Click()
DoCmd.OpenTable "TableName", acViewNormal
End Sub
this will open the table in view mode where you can search.
ASKER
That sounds like a good start, is there a command to bring up the search box once the table is opened?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
adding mourdekai's command line
Private Sub cmdFind_Click()
DoCmd.OpenTable "TableName", acViewNormal
DoCmd.RunCommand acCmdFind
End Sub
should get you going.
bobbobruns12,
?????? should have split the points?
?????? should have split the points?
Private Sub CmdSearch_Click()
On Error GoTo Err_CmdSearch_Click
Screen.PreviousControl.Set
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_CmdSearch_Click:
Exit Sub
Err_CmdSearch_Click:
MsgBox Err.Description
Resume Exit_CmdSearch_Click
End Sub