having trouble referring to a variable in a query criteria (1 Viewer)

atrium

Registered User.
Local time
Tomorrow, 00:40
Joined
May 13, 2014
Messages
348
The delete query that I have written, when executed telss me it can't find the parameter.

The variable is on a subform of the Parent form

The sql for the query is

DELETE SkipTraces.SkipTraceId, *
FROM SkipTraces
WHERE (((SkipTraces.SkipTraceId)=[Forms]![MattersFileFrm]![STraceSubform].[Form]![STraceIdFld]));

I'm sure the problem lies with [Forms]![MattersFileFrm]![STraceSubform].[Form]![STraceIdFld
 

Gasman

Enthusiastic Amateur
Local time
Today, 13:40
Joined
Sep 21, 2011
Messages
14,052
Need subform control name NOT subform name? Are they one and the same?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:40
Joined
Aug 30, 2003
Messages
36,118
Also, when you say "variable" are you referring to an actual VBA variable or a form control (textbox, combo, etc)? Your method will only work with a form control, you can't refer to a variable from outside VBA.
 

atrium

Registered User.
Local time
Tomorrow, 00:40
Joined
May 13, 2014
Messages
348
Thank you Gassman and pbaldy Yes it was the Control name.

What's really annoying is that I know these things but I have trouble recalling them. Old Age I suppose

Thanks again guys
 

Users who are viewing this thread

Top Bottom