Re: Macro to VB
anonymous_at_discussions.microsoft.com
Date: 08/18/04
- Next message: Douglas J. Steele: "Re: SQL CODE WORKS IN ACCESS BUT NOT IN VBA"
- Previous message: Btorn: "SQL CODE WORKS IN ACCESS BUT NOT IN VBA"
- In reply to: Gerald Stanley: "Re: Macro to VB"
- Next in thread: Gerald Stanley: "Re: Macro to VB"
- Reply: Gerald Stanley: "Re: Macro to VB"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 18 Aug 2004 09:06:56 -0700
Gerald,
Your suggestion worked perfectly - now I have two follow-
ups.
1) Can you explain the use of ",' and & in your
examples. I know that double quotes define a string,
ampersand is concantenate and a single quote is a comment,
but that doesn't explain how they work together. Why
different for numeric versus text fields? I know this is
basic stuff, but it just doesn't make sense to me. A good
FAQ (which I haven't found) would be great too.
2) I intended to use the docmd as a part of an If
command. If there is a matching record in the second
table, use the docmd
((DoCmd.OpenForm "frmCTrackGenInfoDE",
acNormal, , "[DLCDGrant#]= " & [Forms]![frmGrantSumDE].
[GrantSumID#])) to open the form with the current record.
Else open a message box to ask if the user wants to create
a new record. I am having trouble defining the condition
in the If command. Can you assist?
Thanks again,
Chappie
>-----Original Message-----
>In the Where condition, try
>"[DLCDGrant#]= " & [Forms]![frmGrantSumDE].[GrantSumID#]
>if GrantSumId is numeric
>or
>"[DLCDGrant#]= '" & [Forms]![frmGrantSumDE].[GrantSumID#]
& "'"
>if it is text
>
>Hope This Helps
>Gerald Stanley MCSD
>>-----Original Message-----
>>In a simple macro, I can use the following syntax in a
>>where condition to open a new form with the current
record
>>displayed:
>>
>>[DLCDGrant#]=[Forms]![frmGrantSumDE].[GrantSumID#]
>>
>>However, when I include this language as a where
condition
>>in the DoCmd.OpenForm action of VB, the correct record
is
>>not opened. How do I change the syntax to make this
>>work? Do I need to declare a variable? If so, what
would
>>the syntax of the variable be?
>>
>>Thanks for any help.
>>
>>Chappie
>>.
>>
>.
>
- Next message: Douglas J. Steele: "Re: SQL CODE WORKS IN ACCESS BUT NOT IN VBA"
- Previous message: Btorn: "SQL CODE WORKS IN ACCESS BUT NOT IN VBA"
- In reply to: Gerald Stanley: "Re: Macro to VB"
- Next in thread: Gerald Stanley: "Re: Macro to VB"
- Reply: Gerald Stanley: "Re: Macro to VB"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|