|
-
Apr 28th, 2001, 01:20 AM
#1
A little QueryDef Education Please?
I am getting an error when I try to requery a table and I do not see anything wrong with the code. Can anyone assist?
The error I get is:
Run Time Error '3421'
Data Type Conversion Error
Here's the code:
Public db As Database
Public rs_detail As Recordset
Private Sub Form_Load()
...
...
Set rs_detail = db.OpenRecordset("SELECT * FROM items ORDER BY blk_no ", dbOpenDynaset, dbReadWrite)
FindDetails (rs_master!blk_no)
...
...
End Sub
Private Sub FindDetails(findBlk As String)
Dim qdef As QueryDef
Dim strsql As String
strsql = "SELECT * FROM items WHERE blk_no = " & findBlk & " ORDER BY blk_no "
Set qdef = db.CreateQueryDef("", strsql)
qdef.SQL = strsql
****** The error occurs on the next line *******
rs_detail.Requery (qdef)
Thanks for the help!
DonB
-
Apr 28th, 2001, 04:13 AM
#2
Addicted Member
strsql = "SELECT * FROM items WHERE blk_no = " & findBlk & " ORDER BY blk_no "
Shouldn't this read
strsql = "SELECT * FROM items WHERE blk_no = '" & findBlk & "' ORDER BY blk_no "
with the single quotes for the findBlk variable?
-
Apr 28th, 2001, 07:42 AM
#3
I have never used single quotes around the variable and it hasn't presented a problem in the past. That being aside even if I do something simple like:
strsql = "SELECT * FROM items"
Set qdef = db.CreateQueryDef("", strsql)
qdef.SQL = strsql
****** The "Data Type Conversion Error" error still occurs on the next line *******
rs_detail.Requery (qdef)
I have tried all types of combinations and no matter what I try I always get the same error
DonB
-
Apr 30th, 2001, 04:16 AM
#4
Fanatic Member
Have you tried using rs_detail.Requery (qdef.Name)?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|