Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

update routine: 2003 to 2010 vba  renaming files

Posted on 2013-02-04
Last Modified: 2013-02-04

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
While Not rs.EOF
  itemname = rs!material_no
  picname = rs!primary_image2
  If itemname <> picname Then
    FileCopy pathname & picname, newpathname & itemname & ".JPG"
  End If
Set rs = Nothing

End Function

Question by:fordraiders
LVL 77

Accepted Solution

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.

Author Closing Comment

ID: 38851630
ok Thanks...

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

840 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