sub or function not defined

B

Bob

I tried to use this the following in the same fashion as
I used the kill command but error out at "rstRecords!
txtStockGraph".

Private Sub Command20_Click()
Dim rstRecords As dao.Recordset
Dim strSql As String
Dim strPath As String

strSql = "select txtStockGraph from tblPictures where
Keywords like '*gym*'"
strPath = "C:\PicLibrary\"

Set rstRecords = CurrentDb.OpenRecordset(strSql)


Do While rstRecords.EOF = False

CopyFile strPath & rstRecords!
txtStockGraph, "C:\PicTransfer\"
rstRecords.MoveNext
Loop
rstRecords.Close
Set rstRecords = Nothing
 
V

Van T. Dinh

Try:

CopyFile strPath & rstRecords.Fields("txtStockGraph").Value,
"C:\PicTransfer\"
 
V

Van T. Dinh

Sorry, just remembered: since CopyFile is not inbuilt in VBA (VBA is
FileCopy), you need to add the Microsoft Scripting Run-time Library into the
References of your database.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top