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
 

Some videos you may like

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

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...
 

Watch MrExcel Video

Forum statistics

Threads
1,118,921
Messages
5,575,043
Members
412,636
Latest member
XinZ
Top