Closing form based on null or Opening a form based on Not Null

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form [Check] that when a [Order] field has been entered, I want
another form [Duplicate] to open ONLY if the query [Duplicate] is based on
returns a result
 
Just before the OpenForm call, check the contents of the query with a
DCount:

If DCount("*", "[Duplicate Query]", "[Order]=" & txtOrder) > 0 Then
DoCmd.OpenForm "Duplicate"
End If

Carl Rapson
 
It is now stating that the txtOrder is not defined and wont do anything

Carl Rapson said:
Just before the OpenForm call, check the contents of the query with a
DCount:

If DCount("*", "[Duplicate Query]", "[Order]=" & txtOrder) > 0 Then
DoCmd.OpenForm "Duplicate"
End If

Carl Rapson

Hendricks97 said:
I have a form [Check] that when a [Order] field has been entered, I want
another form [Duplicate] to open ONLY if the query [Duplicate] is based on
returns a result
 
Actually it works great if I remove the ( , "[Order]=" & txtOrder) section.
Thanks

Carl Rapson said:
Just before the OpenForm call, check the contents of the query with a
DCount:

If DCount("*", "[Duplicate Query]", "[Order]=" & txtOrder) > 0 Then
DoCmd.OpenForm "Duplicate"
End If

Carl Rapson

Hendricks97 said:
I have a form [Check] that when a [Order] field has been entered, I want
another form [Duplicate] to open ONLY if the query [Duplicate] is based on
returns a result
 
'txtOrder' was just a made-up control name, as I don't know what your
control names are; you should substitute your own control name there. The
idea is to see if the query returns any records where Order field matches
whatever is in the [Order] control on your form. If you don't need that
condition, then leaving it out should work.

Carl Rapson

Hendricks97 said:
It is now stating that the txtOrder is not defined and wont do anything

Carl Rapson said:
Just before the OpenForm call, check the contents of the query with a
DCount:

If DCount("*", "[Duplicate Query]", "[Order]=" & txtOrder) > 0 Then
DoCmd.OpenForm "Duplicate"
End If

Carl Rapson

Hendricks97 said:
I have a form [Check] that when a [Order] field has been entered, I want
another form [Duplicate] to open ONLY if the query [Duplicate] is based
on
returns a result
 
Back
Top