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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with DCOUNT - Please see 1

Status
Not open for further replies.

load3d

Programmer
Feb 27, 2008
117
US
If DCount("*", "tbl_lockoutdatabase", "[inserviceYN] = 'Y' ") = 1 Then Forms!newdesign!Frame.SourceObject = "MainSwitchboard"

I have a table with one record that gets updated so there is one record with two possible values either Y or NULL

I want to use DCOUNT to count how many records with Y there and since there should only be one - if it's is = 1 then we go back to the main form.

 
And the problem is ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Please, read carefully either faq in my sig.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Ok. I figured it out.

Couldn't have done it without you PHV! ;)

I had to add a few more lines in.


If DCount("*", "tbl_lockoutdatabase", "[inserviceYN]") = 1 Then Forms!newdesign!Frame.SourceObject = "MainSwitchboard"
If DCount("*", "tbl_lockoutdatabase", "[inserviceYN]") = 1 Then GoTo 55
If DCount("*", "tbl_lockoutdatabase", "[inserviceYN]") = Null Then Forms!newdesign!Frame.SourceObject = "appointment"

55 End sub
 
A more classical way:
Code:
If DCount("*", "tbl_lockoutdatabase", "[inserviceYN]") = 1 Then
  Forms!newdesign!Frame.SourceObject = "MainSwitchboard"
Else
  Forms!newdesign!Frame.SourceObject = "appointment"
End If

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top