Re: Macro to VB

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

anonymous_at_discussions.microsoft.com
Date: 08/18/04


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



Relevant Pages

  • RE: open subform in a new window?
    ... The Syntax for the docmd is ... Adding the following to a command button which uses the where condition - ... Or you can utilise the openargs property. ...
    (microsoft.public.access.formscoding)
  • Re: Accesing structures data (getting lengthy!)
    ... According to the syntax you ... assignment statement just won't stand out amongst all the other ... meaningless dummy variables that you have to keep track of. ... comparitively easy to pick out of a long, boring, command line history, ...
    (comp.soft-sys.matlab)
  • Re: Windows could not upgrade the file..........Security update KB
    ... "Sky King" wrote in message ... > Robert Aldwinckle wrote: ... I would not have offered my tip about copying text from a command ... probably over a simple syntax error. ...
    (microsoft.public.windowsupdate)
  • Re: krb5kdc_err_s_principal_unknown on Windows Kerberos Domain
    ... command line with the parameter "tickets". ... fail group policy replication for users. ... I went to the command line and tested this unusual syntax, ...
    (comp.protocols.kerberos)
  • Re: What if jQuery was written in Tcl?
    ... Ah, to capture the namespace in which you're executing, so that ... command resolution and work correctly. ... This is common when embedding foreign languages in Tcl. ... SQL's syntax; are you suggesting a similar language-specific rule for ...
    (comp.lang.tcl)