Running database I created on a new computer, and a weird error

ekeenan81

New Member
Joined
Dec 8, 2010
Messages
39
I was building an Acccess database where everything was running fine on my old laptop.

I ran on a new computer, and I am getting the below error.

The Microsoft Office Access database engine could not find the object '1'. Make sure the object exists and that you spell its name and path name correctly.

Basically I have a main form where I have an option to select 'search by last name' this opens up a new form that is fed data based off a simple query.

The code below should be straightforward so I don't see what I am missing here.

Lookup By Last Name is the 'Form', and the Query is called Search By Last Name.

Any help would be appreciated.

Thanks

Private Sub Search_By_Last_Name_Click()
On Error GoTo Err_Search_By_Last_Name_Click
Dim stDocName As String
stDocName = "Lookup By Last Name"
DoCmd.OpenForm stDocName, acNormal, acEdit
Exit_Search_By_Last_Name_Click:
Exit Sub
Err_Search_By_Last_Name_Click:
MsgBox Err.Description
Resume Exit_Search_By_Last_Name_Click
End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Code:
DoCmd.OpenForm stDocName, acNormal, acEdit

The order of the arguments seem wrong. Should be a FilterMode argument where you have acEdit (and I assume, btw, that acEdit has the constant value of 1).

I should just wipe the code, turn on the wizard, and re-generate the code. Or read the argument descriptions for OpenForm and fix:
http://www.datawright.com.au/access_resources/access_docmd.openform_arguments.htm
http://msdn.microsoft.com/en-us/library/aa141520(v=office.10).aspx

Note: don't ask me why it worked before. Haven't a clue...
 
Upvote 0

Forum statistics

Threads
1,196,460
Messages
6,015,376
Members
441,889
Latest member
balolaptopgiaolong

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top