Jerry N
asked on
Access 2010 Error 2046: RunCommand acCmdDatasheetView (Find)
I'm running a form that is based on a linked table.
Simple form, just two text boxes.
I have a routine that looks like this:
Sub Listit(sFormName As String)
If Forms(sFormName).CurrentVi ew = 1 Then
DoCmd.RunCommand acCmdDatasheetView
Else
DoCmd.RunCommand acCmdFormView
End If
I pass the Me.name but it's giving me a 2046 that it cant do that right now.
It also does the same thing when I try to use the RunCommand on FIND.
I had been using the menu type commands in 2003, but thought this would be cleaner and work better.
Any clue on fixing this?
Simple form, just two text boxes.
I have a routine that looks like this:
Sub Listit(sFormName As String)
If Forms(sFormName).CurrentVi
DoCmd.RunCommand acCmdDatasheetView
Else
DoCmd.RunCommand acCmdFormView
End If
I pass the Me.name but it's giving me a 2046 that it cant do that right now.
It also does the same thing when I try to use the RunCommand on FIND.
I had been using the menu type commands in 2003, but thought this would be cleaner and work better.
Any clue on fixing this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'll give it a try - Makes sense.
What about FIND - doesnt that just popup a find interface? why would I get the error there?
What about FIND - doesnt that just popup a find interface? why would I get the error there?
There are just certain times when a certain command is not possible.
So you have to be clear on when/how you are running these codes
Also note that spell check will not work if the Allow edits property is set to No.
JeffCoachman
So you have to be clear on when/how you are running these codes
Also note that spell check will not work if the Allow edits property is set to No.
JeffCoachman
...and to close out, I will say that what I posted is more of a brute force solution...
...not sure why you need to change the view dynamically...?
...not sure why you need to change the view dynamically...?
You have to close the form, then reopen it with the new view setting