Solved

update routine: 2003 to 2010 vba  renaming files

Posted on 2013-02-04
2
220 Views
Last Modified: 2013-02-04
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_21499562.html

reference question: above.

I have the code below working in 2003 vba..

But Office 2010 vba gives me an error on line:

Function CopyFilesJpg2()
Dim rs
Dim pathname, newpathname, itemname, picname As String
pathname = "C:\Images\"
newpathname = "C:\Images\New\"
Me.RecordSource = "SELECT * FROM NoPic_Picture_NotAll" <<<<---error here...invalid use of "me"...
Set rs = Me.Recordset.Clone
rs.MoveFirst
While Not rs.EOF
  itemname = rs!material_no
  picname = rs!primary_image2
  If itemname <> picname Then
    FileCopy pathname & picname, newpathname & itemname & ".JPG"
  End If
  rs.MoveNext
Wend
rs.Close
Set rs = Nothing

End Function


Thanks
fordraiders
0
Comment
Question by:fordraiders
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 38851603
The code assumes it is located in a form module.

If it is not, it doesn't make much sense as a routine.

But the error suggests you have placed it in a standard module.
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 38851630
ok Thanks...
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now