type mismatch problem

1. Member
Join Date
Dec 1969
Posts
35

## type mismatch problem

I am trying to check for a number in a database. I have assured that the type is a number in the db but am receiving an error message that says type mismatch. I receive the error message for whichever age option that I choose. Anybody have any ideas?<BR>Here is my code:<BR><BR>If Age = "1" Then<BR> If rsDB("dAge") &#060; 1 Then<BR> dogtotal = dogtotal + AgeVal<BR> End If<BR> End If<BR> <BR> If Age = "5" Then<BR> If rsDB("dAge") &#060;= 5 AND rsDB("dAge") &#062;= 1 Then<BR> dogtotal = dogtotal + AgeVal<BR> End If<BR> End If<BR> <BR> If Age = "10" Then<BR> If rsDB("dAge") &#060;= 10 AND rsDB("dAge") &#062;= 6 Then<BR> dogtotal = dogtotal + AgeVal<BR> End If<BR> End If<BR><BR> If Age = "11" Then<BR> If rsDB("dAge") &#060; 10 Then<BR> dogtotal = dogtotal + AgeVal<BR> End If<BR> End If<BR>

2. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## On which line

see if this helps<BR><BR><BR>If Age = "11" Then<BR>If clng(rsDB("dAge")) &#060; 10 Then<BR>dogtotal = clng(dogtotal) + clng(AgeVal)<BR>End If<BR>End If<BR>

3. Member
Join Date
Dec 1969
Posts
35

## Thanks it works but why did it work

?

4. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## Cuase you are

either comparing a string with a number or trying to add a string to a number or vice versa<BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•