Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i represent a variable in a do command line. 1

Status
Not open for further replies.

lewie

Technical User
Jan 17, 2003
94
US
I am doing these queries based on the value txttapetype
if txttapetype is DTR it will perform these. I tried replacing DTR in the query names with the variable but it didn't recognize it. do i have to annotate it somehow so it knows its a variable. This way i can use one set to run them all.


'DTR
Case Is = "DTR"
DoCmd.OpenQuery "LB Make txttapetype table", acViewNormal, acEdit
DoCmd.OpenQuery "LB Append txttapetype to txttapetype master #", acViewNormal, acEdit
DoCmd.OpenQuery "LB update txttapetype # part 1", acViewNormal, acEdit
DoCmd.OpenQuery "LB update txttapetype # part 2", acViewNormal, acEdit
DoCmd.OpenQuery "LB last Update txttapetype ID to txttapetype Master", acViewNormal, acEdit
MsgBox txttapetype
Thanks
Lewie
 
Hello
what does the Select look like? If I understand what you want it should look like this.

Select Case txttapetype
Case "DTR"
DoCmd.OpenQuery "LB Make txttapetype table", acViewNormal, acEdit
DoCmd.OpenQuery "LB Append txttapetype to txttapetype master #", acViewNormal, acEdit
DoCmd.OpenQuery "LB update txttapetype # part 1", acViewNormal, acEdit
DoCmd.OpenQuery "LB update txttapetype # part 2", acViewNormal, acEdit
DoCmd.OpenQuery "LB last Update txttapetype ID to txttapetype Master", acViewNormal, acEdit
MsgBox txttapetype
Case Else
End Select

Tom
 
If you wanted to use the value of txttapetype as part of the name of the query then this should work.

Select Case txttapetype
Case "DTR"
DoCmd.OpenQuery "LB Make " & txttapetype & " table", acViewNormal, acEdit
DoCmd.OpenQuery "LB Append " & txttapetype & " to " & txttapetype & " master #", acViewNormal, acEdit
DoCmd.OpenQuery "LB update " & txttapetype & " # part 1", acViewNormal, acEdit
DoCmd.OpenQuery "LB update " & txttapetype & " # part 2", acViewNormal, acEdit
DoCmd.OpenQuery "LB last Update " & txttapetype & " ID to txttapetype Master", acViewNormal, acEdit
MsgBox txttapetype
Case Else
End Select

Tom
 
So "&" is sort of a dereferencer. Why the quotes.
Thanks alot works good.
You deserve a star.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top