DoCmd.OpenFOrm not working on new computer

cheesiepoof05

Board Regular
Joined
Dec 30, 2010
Messages
82
We have been using an Access form that you can double click on the results and it opens up another form "FRM_EDIT". I have about 5 computers that use the same thing and haven't had any trouble. Recently we got two more PCs and neither of them do anything when you double click to open the next form. This is the code that I believe is supposed to generate the double click to open "FRM_EDIT".

Private Sub lstViewResults_DblClick()
If IsNull(Me.lstViewResults.SelectedItem) Then Exit Sub
DoCmd.OpenForm "FRM_EDIT", acNormal, ,"[Document Number] = '" & Me.lstViewResults.SelectedItem &"'"
End Sub

Thank you!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Is VBA code enabled for them?

You can add a message box for a quick check to see if the code behind the button is being called, i.e.
Code:
[SIZE=2][FONT=arial][COLOR=#333333][COLOR=#000000]Private Sub lstViewResults_DblClick()
[/COLOR][/COLOR][COLOR=#ff0000]    MsgBox "Button clicked"[/COLOR]
[COLOR=#333333][COLOR=#000000]    If IsNull(Me.lstViewResults.SelectedItem) Then Exit Sub[/COLOR][/COLOR]
[COLOR=#333333][COLOR=#000000]    DoCmd.OpenForm "FRM_EDIT", acNormal, ,"[Document Number] = '" & Me.lstViewResults.SelectedItem &"'"[/COLOR][/COLOR]
[COLOR=#333333][COLOR=#000000]End Sub[/COLOR][/COLOR][/FONT][/SIZE]
If you do not at least get the message box when double-clicking the button, the VBA code is not being called (either because VBA is not enabled or the code isn't linked to the button).

One other thing to check is to check sure that they have all the appropriate VBA Libraries and References selected.
If you go into the VB Editor (on a computer where this DOES work), go to the Tools menu and select References.
Note all the references that are selected.
Now, go to a computer where this is not working, and do the same thing to see if they have all the appropriate references selected. If not, select the missing ones.

Note, that if you are on a different version of Access, the reference names may not match exactly (the version number may be different). Just pick the newest version available listed for each one.
 
Last edited:
Upvote 0
is doc# a string? Numbers are usu numbers.
then it would be:
"[Document Number] =" & Me.lstViewResults.SelectedItem
 
Last edited:
Upvote 0
This seemed like it had to be it, but we're using the same version and all the same boxes were checked. All Macros and Active X are fully enabled. When I added the MsgBox to the code and tried double clicking, nothing happened still.


Is VBA code enabled for them?

You can add a message box for a quick check to see if the code behind the button is being called, i.e.
Code:
[SIZE=2][FONT=arial][COLOR=#333333][COLOR=#000000]Private Sub lstViewResults_DblClick()
[/COLOR][/COLOR][COLOR=#ff0000]    MsgBox "Button clicked"[/COLOR]
[COLOR=#333333][COLOR=#000000]    If IsNull(Me.lstViewResults.SelectedItem) Then Exit Sub[/COLOR][/COLOR]
[COLOR=#333333][COLOR=#000000]    DoCmd.OpenForm "FRM_EDIT", acNormal, ,"[Document Number] = '" & Me.lstViewResults.SelectedItem &"'"[/COLOR][/COLOR]
[COLOR=#333333][COLOR=#000000]End Sub[/COLOR][/COLOR][/FONT][/SIZE]
If you do not at least get the message box when double-clicking the button, the VBA code is not being called (either because VBA is not enabled or the code isn't linked to the button).

One other thing to check is to check sure that they have all the appropriate VBA Libraries and References selected.
If you go into the VB Editor (on a computer where this DOES work), go to the Tools menu and select References.
Note all the references that are selected.
Now, go to a computer where this is not working, and do the same thing to see if they have all the appropriate references selected. If not, select the missing ones.

Note, that if you are on a different version of Access, the reference names may not match exactly (the version number may be different). Just pick the newest version available listed for each one.
 
Upvote 0
Ranman, I don't think it is an issue with the code because it works fine on other computers and has for years.
 
Last edited:
Upvote 0
This seemed like it had to be it, but we're using the same version and all the same boxes were checked. All Macros and Active X are fully enabled. When I added the MsgBox to the code and tried double clicking, nothing happened still.
Then it is not calling the code.
They are double-clicking and not single-clicking, right? Note that you can set the speed in which the double-click has to happen (I believe it is a mouse setting on the computer). Maybe try playing around with that. Or temporarily setting it to single-click, just to see if that gets it to work. If it does, then you know the issue has to do with double-clicking.

Or maybe this is what is going on: https://www.youtube.com/watch?v=LqidQFr1v5U
:rofl:
 
Last edited:
Upvote 0
anti-virus program ?

I've had my av program flag all kinds of stuff and stop it from running (even importing an excel worksheet into access)
 
Upvote 0
The click speed is actually the first thing I tried, to no avail. Thanks for the suggestion.

Then it is not calling the code.
They are double-clicking and not single-clicking, right? Note that you can set the speed in which the double-click has to happen (I believe it is a mouse setting on the computer). Maybe try playing around with that. Or temporarily setting it to single-click, just to see if that gets it to work. If it does, then you know the issue has to do with double-clicking.

Ot maybe this is what is going on: https://www.youtube.com/watch?v=LqidQFr1v5U
:rofl:
 
Upvote 0
Did you try changing the event from double-click to something else to see if you could get it to work?
Does any other VBA on the project work?
 
Upvote 0
So I have tried a couple additional things and still no success. I changed double-click to single click, verified that my computer now opens the entry with single click, their computer still doesn't do anything. I also put in a pop-up box that pops up when the double click event is kicked off and it worked on mine, but not the new computer again.

Did you try changing the event from double-click to something else to see if you could get it to work?
Does any other VBA on the project work?
 
Upvote 0

Forum statistics

Threads
1,223,895
Messages
6,175,257
Members
452,625
Latest member
saadat28

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