DoCmd using Variables

Jmsteph

Registered User.
Local time
Today, 07:17
Joined
Dec 2, 2008
Messages
28
I want to use a variable on a DoCmd so that I can use DLookup to fund how to open each file in VBA.

When I use the below snipit of code I get the error Method or data member not found for "DT" and Type Mismatch for "VO". Anyone have any idea's? Thanks,

DT = "OpenQuery"
VO = "acViewNormal"
DoCmd.DT RepList, VO, acReadOnly
 
DoCmd.OpenQuery VO might work, but I am not sure you can use the DT as that is a part of the command.

You might want to instead use the variables for a case argument and select the case based on the command you want to select.

Select Case DT
Case 1
DoCmd.OpenQuery = "acViewNormal"
Case 2
etc etc.....
End Select
 
DoCmd.OpenQuery = "acViewNormal"
Not quite right.

@JmstephThose are enumerations which have Integer equivalents, text isn't allowed unless you create a mapping.
 
Not quite right.

@JmstephThose are enumerations which have Integer equivalents, text isn't allowed unless you create a mapping.

Thank you. I wasn't really sure, as I am still new to VBA. I have other languages under my belt, btu alot to learn for VBA for all of the syntax changes.
 

Users who are viewing this thread

Back
Top Bottom