I keep getting an error 13 type mismatch in the statement where I use DCOUNT
I am simply trying to get the number of records for a specific [ClientId] and [Gender] is equal to Male
I have implemented the suggestion of my previous post done on yesterday and am still stuck.
I tried to change Answ to string and also to integer with no luck
If anyone could please help me I would be grateful
Thanks so much
Jim
_________________________________________________________
Option Compare Database
Option Explicit
Private Sub Form_AfterUpdate()
Dim malesx As Integer
Dim Answ As String
Dim mycriteria As String
Dim malecst As String
malecst = "Male"
MsgBox malecst ' value of malecst is Male
MsgBox "'" & Forms!HomePage!NavigationSubform.Form!ClientID & "'"
mycriteria = "'" & Forms!HomePage!NavigationSubform.Form!ClientID & "'"
MsgBox mycriteria & " mycriteria" 'contents on execution is 'ACOSCA' which is the correct key for [ClientId] (actual key is ACOSCA without the quotes)
Answ = Forms!HomePage!NavigationSubform.Form!.[#MalesHousehold] 'Answ is the contents of [#MalesHousehold] before and is ok
MsgBox Answ
Answ = DCount("[Gender]", "Household Information", "[ClientId]= 'mycriteria &'" And "[Gender]= 'malecst'&") 'this is command that I get error 13 type mismatch
Forms!HomePage!NavigationSubform.Form!.[#MalesHousehold] = Answ
End Sub
____________________________________________________________
[Gender] is defined as a string
[Clientid] is defined as a string
[#MalesHousehold] is defined as a integer
I am simply trying to get the number of records for a specific [ClientId] and [Gender] is equal to Male
I have implemented the suggestion of my previous post done on yesterday and am still stuck.
I tried to change Answ to string and also to integer with no luck
If anyone could please help me I would be grateful
Thanks so much
Jim
_________________________________________________________
Option Compare Database
Option Explicit
Private Sub Form_AfterUpdate()
Dim malesx As Integer
Dim Answ As String
Dim mycriteria As String
Dim malecst As String
malecst = "Male"
MsgBox malecst ' value of malecst is Male
MsgBox "'" & Forms!HomePage!NavigationSubform.Form!ClientID & "'"
mycriteria = "'" & Forms!HomePage!NavigationSubform.Form!ClientID & "'"
MsgBox mycriteria & " mycriteria" 'contents on execution is 'ACOSCA' which is the correct key for [ClientId] (actual key is ACOSCA without the quotes)
Answ = Forms!HomePage!NavigationSubform.Form!.[#MalesHousehold] 'Answ is the contents of [#MalesHousehold] before and is ok
MsgBox Answ
Answ = DCount("[Gender]", "Household Information", "[ClientId]= 'mycriteria &'" And "[Gender]= 'malecst'&") 'this is command that I get error 13 type mismatch
Forms!HomePage!NavigationSubform.Form!.[#MalesHousehold] = Answ
End Sub
____________________________________________________________
[Gender] is defined as a string
[Clientid] is defined as a string
[#MalesHousehold] is defined as a integer