Code Challenge

Tom Vert

New Member
Joined
Oct 30, 2004
Messages
43
Hi Folks

Any ideas on why the following code does not open a pop form with information linked to the SERIES field in my table? The data is a number (but could be text) and formatted as '0000' The numbers are not distinct (several numbers repeat many times) and I simply want to double click a control a form and have open another form with appropriate data.

Thanks for your help.

Private Sub SERIES_DblClick(Cancel As Integer)

On Error GoTo Err_SERIES_DblClick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmSERIES DEFINITIONS"

stLinkCriteria = "[SERIES]=" & "'" & Me![SERIES] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_SERIES_DblClick:
Exit Sub

Err_SERIES_DblClick:
MsgBox Err.Description
Resume Exit_SERIES_DblClick

End Sub
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

cstlaurent

Board Regular
Joined
Jan 14, 2005
Messages
182
You might want do define the Me! forms. Some time, I don't know why Access get confuse with the Me!. I rather specified each time the complet name of the form where the data are.

good luck
 

Tom Vert

New Member
Joined
Oct 30, 2004
Messages
43
The form pops up, but there's no data. Not sure why ... I have an identical procedure in an adjacent control and it works fine. Frustration is setting in. :confused:
 

Russell Hauf

MrExcel MVP
Joined
Feb 10, 2002
Messages
1,611
If the field is numeric, you'll want to get rid of the single quotes:

stLinkCriteria = "[SERIES]=" & Me![SERIES]

HTH,
Russell
 

Tom Vert

New Member
Joined
Oct 30, 2004
Messages
43

ADVERTISEMENT

Thanks Russell. I changed the code, but instead of getting a pop up with no data, I get a Microsoft Access error:

"The OpenForm action was canceled." With no reason why.

Do you think the duplicate numbers in the field are causing a linkage problem? Tom
 

Russell Hauf

MrExcel MVP
Joined
Feb 10, 2002
Messages
1,611
Sorry, I couldn't say without more info. Do you know how to step through code? I'd start there...
 

Tom Vert

New Member
Joined
Oct 30, 2004
Messages
43

ADVERTISEMENT

I'm pretty much a "frustrated novice" and don't know how to step thru code. Are you speaking of the immediate window and a line-by-line approach?
 

Russell Hauf

MrExcel MVP
Joined
Feb 10, 2002
Messages
1,611
Technically not the immediate window, but probably what you're referring to. You can set breakpoints and see what's going on. There are a lot of factors that could be in play here, including how your "pop form" functions. I'm sorry I can't be of more help...
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,505
Messages
5,832,128
Members
430,111
Latest member
Francis Xavier

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
Top