|
-
Jan 12th, 2004, 03:23 PM
#1
Thread Starter
Hyperactive Member
what is wrong with this?
Access Module
Public Function ImportData()
Dim dbs as database
Dim Rst as recordset
Dim mysql as string
Set dbs = Opendatabase(CurrentDb)
mySql = "Select * from Tbl_GetData"
Set rst = dbs.openrecordset(mySql) 'error occures here
Do Until rst.EOF
dbtype = rst.Fields(4).Value
filename = rst.Fields(3).Value
PathName = rst.Fields(2).Value
TableName = rst.Fields(1).Value
DoCmd.DeleteObject acTable, TableName
DoCmd.TransferDatabase acImport, dbtype, PathName, acDefault, filename, TableName, 0, True
rst.MoveNext
Loop
rst.close
dbs.close
End Function
Swoozie
Somedays you just should not get out of bed.
-
Jan 12th, 2004, 04:55 PM
#2
Frenzied Member
Does the query work if you build it in Query Designer? If so, try copying the SQL from there to your code. Not sure if Access requires it, but when you go through the Designer, it appends a semi-colon to the end of the SQL statement (before the last double quote).
Also, in code I maintain, I don't use:
Set dbs = Opendatabase(CurrentDb)
Try just Set dbs = CurrentDB
-
Jan 12th, 2004, 05:04 PM
#3
Thread Starter
Hyperactive Member
I found the error, it was only a typo of course.
Swoozie
Somedays you just should not get out of bed.
-
Jan 15th, 2004, 08:18 AM
#4
Fanatic Member
Originally posted by swoozie
I found the error, it was only a typo of course.
Always the way
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
|