I really messed up and am looking for your thoughts to solve problem
I designed a table called FAMILIES
ClientID text This field is the ID for the entire family composition
Lname text
Fname text
Gender Integer (Which should have been text)
(This field is linked to a drop down box table where the only permissible values are Male or Female) the field in the drop down table was correctly defined as text lets call it field M/F
If I listed the table FAMILIES
The Gender field show either Male or Female correctly
Months later I was asked to sum all the males and females in a family.
I used Dcount and entered the criteria of the ClientID AND "Male".
Trying to get the number of males in a particular family.
After 3 days of using every possible syntax for the Dcount function I could not get it to work.
I then deleted all the relations ships to the table FAMILIES and changed the Gender field to Text as it should have been from the beginning.
I am thinking that since I defined it incorrectly to begin with, it is stored in the database as an integer representation of the Male value.
This is the last attempt which returns a value of zero males, which is wrong.
Private Sub Form_AfterUpdate()
Dim malesx As String
male = male
MsgBox "[ClientId]= '" & Forms!HomePage!NavigationSubform.Form!ClientID & "'"
malesx = Nz(DCount("[Gender]", "Household Information", "[ClientId]= '" & Forms!HomePage!NavigationSubform.Form!ClientID & "' AND [Gender]= 'male'"))
MsgBox malex
Forms!HomePage!NavigationSubform.Form!.[#MalesHousehold] = malesx
End Sub
Really at a loss not sure what to do. If you can help I really would appreciate it very much.
Jim
I designed a table called FAMILIES
ClientID text This field is the ID for the entire family composition
Lname text
Fname text
Gender Integer (Which should have been text)
(This field is linked to a drop down box table where the only permissible values are Male or Female) the field in the drop down table was correctly defined as text lets call it field M/F
If I listed the table FAMILIES
The Gender field show either Male or Female correctly
Months later I was asked to sum all the males and females in a family.
I used Dcount and entered the criteria of the ClientID AND "Male".
Trying to get the number of males in a particular family.
After 3 days of using every possible syntax for the Dcount function I could not get it to work.
I then deleted all the relations ships to the table FAMILIES and changed the Gender field to Text as it should have been from the beginning.
I am thinking that since I defined it incorrectly to begin with, it is stored in the database as an integer representation of the Male value.
This is the last attempt which returns a value of zero males, which is wrong.
Private Sub Form_AfterUpdate()
Dim malesx As String
male = male
MsgBox "[ClientId]= '" & Forms!HomePage!NavigationSubform.Form!ClientID & "'"
malesx = Nz(DCount("[Gender]", "Household Information", "[ClientId]= '" & Forms!HomePage!NavigationSubform.Form!ClientID & "' AND [Gender]= 'male'"))
MsgBox malex
Forms!HomePage!NavigationSubform.Form!.[#MalesHousehold] = malesx
End Sub
Really at a loss not sure what to do. If you can help I really would appreciate it very much.
Jim