Hi guys....
I'm trying to achieve a form displayed at startup which has several command buttons, one of which is "Display Database Window".
I looked at the example in the Northwind database.
In my scenario, I don't want to close the original form, so I commented out the "DoCmd.Close". Worked perfectly.
On reading the Help files, I discovered that I could remove the references to StrDocName, provided that the InDatabaseWindow option was still set to True.
I changed that line of code to read
and everything still works fine.
Finally, in Tools/Startup I unchecked the Display Database Window box.
Now, when I start Northwind, I get the "Main Switchboard" form with no Database Window, but on hitting the button, the Database Window appears.
Perfect!
Then I copied the code into my development database.
Now, when I hit the button on my development database, I get the following message :-
"The expression On Click you entered as the event property setting produced the following error:
Procedure Declaration does not match description of event or procedure having the same name.
*The expression may not result in the name of a macro, the name of a user defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro"
I've checked the References section in both databases - they're identical.
In case I've missed something obvious, my code is as below
Can anyone help?
I'm trying to achieve a form displayed at startup which has several command buttons, one of which is "Display Database Window".
I looked at the example in the Northwind database.
Code:
Sub DisplayDatabaseWindow_Click()
' This code created in part by Command Button Wizard.
On Error GoTo Err_DisplayDatabaseWindow_Click
Dim strDocName As String
strDocName = "Categories"
' Close Main Switchboard form.
DoCmd.Close
' Give focus to Database window; select Categories table (first
' form in list).
DoCmd.SelectObject acTable, strDocName, True
Exit_DisplayDatabaseWindow_Click:
Exit Sub
Err_DisplayDatabaseWindow_Click:
MsgBox Err.Description
Resume Exit_DisplayDatabaseWindow_Click
End Sub
On reading the Help files, I discovered that I could remove the references to StrDocName, provided that the InDatabaseWindow option was still set to True.
I changed that line of code to read
Code:
DoCmd.SelectObject acTable, , True
Finally, in Tools/Startup I unchecked the Display Database Window box.
Now, when I start Northwind, I get the "Main Switchboard" form with no Database Window, but on hitting the button, the Database Window appears.
Perfect!
Then I copied the code into my development database.
Now, when I hit the button on my development database, I get the following message :-
"The expression On Click you entered as the event property setting produced the following error:
Procedure Declaration does not match description of event or procedure having the same name.
*The expression may not result in the name of a macro, the name of a user defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro"
I've checked the References section in both databases - they're identical.
In case I've missed something obvious, my code is as below
Code:
Private Sub DisplayDatabaseWindow_Click()
On Error GoTo Err_DisplayDatabaseWindow_Click
'Give focus to Database window;
'select Categories "table" (operand is acTable),
'which is the first form in the list.
DoCmd.SelectObject acTable, , True
Exit_DisplayDatabaseWindow_Click:
Exit Sub
Err_DisplayDatabaseWindow_Click:
MsgBox Err.Description
Resume Exit_DisplayDatabaseWindow_Click
End Sub
Can anyone help?