-----Original Message-----
1)  You are composing a string for the WHERE condition.
Your original statement was being translated into looking
for row(s) where the column [DLCDGrant#] was equal to the
string literal [Forms]![frmGrantSumDE].[GrantSumID#].
The use of the double quotes and the & makes the
translation [DLCDGrant#] being equal to the value held in
the identifier [Forms]![frmGrantSumDE].[GrantSumID#].
The use of the single quote is a JET requirement to
differentiate strings from numbers (and from dates, which
need to be enclosed in # marks) in comparisons.
2)  You should be able to use the DLookUp function and
check for a Null Return indicating no match e.g.
If IsNull(DLookUp("[DLCDGrant#]", "YourTableName",
"[DLCDGrant#]= " & [Forms]![frmGrantSumDE]. [GrantSumID#])) Then
MsgBox "No Matching Record"
Else
DoCmd.OpenForm "frmCTrackGenInfoDE",
	
	
		
		
			acNormal, , "[DLCDGrant#]= " & [Forms]![frmGrantSumDE].
[GrantSumID#]
		
		
	 
End If
Be sure to insert your own table name as the 2nd parameter
in the DLookUp statement.
Hope This Helps
Gerald Stanley MCSD
	
	
		
		
			-----Original Message-----
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
.
.
.
		
		
	 
.