HELP: "Type Mismatch" when opening recordset

HELP: "Type Mismatch" when opening recordset

Post by JoeyLem » Wed, 17 Apr 1996 04:00:00



I am trying to put all records between two dates into a recordset.
However, with the following piece of code, Visual Basic 4.0 (Enterprise)
screams "Error 13 - Type Mismatch" when it gets to the line to open the
recordset.

Temp is never defined.  Text1 through Text6 should contain numeric values.
 The database object (DataNarf) does work... it works everywhere else in
the program...

---- BEGIN CODE ----

temp = text1.Text & "/" & Text2.Text & "/" & Text3.Text
StartDate = CDate(temp)

temp = Text4.Text & "/" & Text5.Text & "/" & Text6.Text
EndDate = CDate(temp)

SQL$ = "Select * from Server_Callinfo Where CallTime BETWEEN '" &
StartDate & "' AND '" & EndDate & "'"

Set RecordZort = DataNarf.OpenRecordset(SQL$, dbOpenDynaset)

---- END CODE ----

If you can figure out what I'm doing wrong, please email me.  I've got a
deadline breathing down my neck... :/


 
 
 

HELP: "Type Mismatch" when opening recordset

Post by Paul Cho » Fri, 19 Apr 1996 04:00:00


joey:

there a couple of ways to make your sql$:

[1].  since the textbox values are numeric:

      startdate=dateserial(text3,text1,text2)          'dateserial(yy,mm,dd)
      enddate=dateserial(text6,text4,text)

      sql$="Select * from Server_Callinfo Where CallTime BETWEEN " &
           StartDate & " AND " & EndDate

or

[2].  

      startdate="#" & text1 & "/" & text2 & "/" & text3 & "#"
      enddate  ="#" & text4 & "/" & text5 & "/" & text6 & "#"

      sql$="Select * from Server_Callinfo Where CallTime BETWEEN " &
           StartDate & " AND " & EndDate

good luck.

-paul-


>I am trying to put all records between two dates into a recordset.
>However, with the following piece of code, Visual Basic 4.0 (Enterprise)
>screams "Error 13 - Type Mismatch" when it gets to the line to open the
>recordset.

>Temp is never defined.  Text1 through Text6 should contain numeric values.
> The database object (DataNarf) does work... it works everywhere else in
>the program...

>---- BEGIN CODE ----

>temp = text1.Text & "/" & Text2.Text & "/" & Text3.Text
>StartDate = CDate(temp)

>temp = Text4.Text & "/" & Text5.Text & "/" & Text6.Text
>EndDate = CDate(temp)

>SQL$ = "Select * from Server_Callinfo Where CallTime BETWEEN '" &
>StartDate & "' AND '" & EndDate & "'"

>Set RecordZort = DataNarf.OpenRecordset(SQL$, dbOpenDynaset)

>---- END CODE ----

>If you can figure out what I'm doing wrong, please email me.  I've got a
>deadline breathing down my neck... :/




 
 
 

1. Help: "Data type mismatch"

I'm getting a strange error.  For some reason when I go to insert
variables into my table using "Insert into <table> from memvar"
I keep getting a "Data type mismatch" error.  I don't understand
it.  I've done this thing many times before with no error.

Any help would be welcome.  I would prefer e-mail responses.

Thanks a bunch,
Daniel

2. pick = valhalla

3. Spooky "Type Mismatch in Expression" problem

4. frequently deleted table

5. "Run-time error 13: Type Mismatch"

6. Open objects (server configuration parameter)

7. SELECT * "TYPE MISMATCH"

8. How to prevent connections to a database?

9. Q: SQLForeignKeys gives "Type mismatch"

10. Handling "Type mismatch" error

11. "Runtime Error 13 Data Type mismatch"

12. Record.open "", "URL=..."

13. Are Table-type recordsets "self-refreshing"?