DCount Type Mismatch Problem

  • Thread starter Thread starter esi
  • Start date Start date
E

esi

Trying to use the following code but keep getting a type mismatch error. My
[Counted] field is a yes/no field

Dim stDocName As String

stDocName = "UploadMacro"

If DCount("*", "DrugTemp") = DCount("*", "DrugTemp", "[Counted]=True")
Then
DoCmd.RunMacro stDocName
Else
MsgBox "Please be sure that all items have been counted before
uploading", "vbOKOnly","Error"
End If
 
vbokonly should not be in quotes: it is a built-in numeric constant.

esi, when you quote an error message, please say what line it occurs on.
You< know that - we do not.

HTH,
TC


esi said:
Trying to use the following code but keep getting a type mismatch error. My
[Counted] field is a yes/no field

Dim stDocName As String

stDocName = "UploadMacro"

If DCount("*", "DrugTemp") = DCount("*", "DrugTemp", "[Counted]=True")
Then
DoCmd.RunMacro stDocName
Else
MsgBox "Please be sure that all items have been counted before
uploading", "vbOKOnly","Error"
End If
 
Try wrapping both DCounts in NZ
NZ(Dcount(...),0")
This will get rid of Nulls



Trying to use the following code but keep getting a type mismatch error. My
[Counted] field is a yes/no field

Dim stDocName As String

stDocName = "UploadMacro"

If DCount("*", "DrugTemp") = DCount("*", "DrugTemp", "[Counted]=True")
Then
DoCmd.RunMacro stDocName
Else
MsgBox "Please be sure that all items have been counted before
uploading", "vbOKOnly","Error"
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top