Results 1 to 10 of 10
  1. #1
    mrod0442 is offline Novice
    Windows XP Access 2013
    Join Date
    Oct 2013
    Posts
    3

    Changing ID number attached to a Picture??


    Hello Newbie here, so I have this program that we use for ID pictures. Through the program we have the persons info and assigned ID number, when we import an image to his profile the program changes the name of the actual image to his ID number. In the program itself there is an button to change the ID number very easily, individually. My question is how can I change the ID numbers for 1600 people through the ACCESS, since it is an ACCESS program. When I change the number in the subjects table it shows the change when I open the Program but the image no longer shows up because the ID number is different. Any help would be appreciated and I have ACCESS 2013. Thank you.

  2. #2
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Basically, you will take a junk version of the database, find the code behind that button that does your desired act once, and then you will run that code in a loop to do it 1600 times.

    You will test your code in the junk version of the database and will not run it in the real database until you have absolutely verified that it works exactly as desired.

    You will probably have a file or table somewhere of the from- and to- ID numbers, and you will probably use a cursor to read that file/table as a recordset, in essence using VBA to pretend that someone is clicking the button once for each record.

    You will test the process with a file containing, for example, three records. If that works, you will test it for a dozen more. If that works, then you can run your 1600 (minus the ones that are already done).

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    You import the image into some program, not Access?
    That other program uses Access for a database?
    You have a link in another Access db to table in the other program?
    You change the ID in that linked table?
    The image then does not show in that other program?
    There must be another table storing the images.
    I don't think you should change that ID.
    It is apparently being used as a PK/FK link between tables in that other program.
    If you must change the ID, then will have to change in all tables that use the ID.
    Changing PK/FK values is tricky.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    June - I was under the impression that it was just the name of the image file, on the network, that was being changed to the new ID. Apparently they have assigned a lot of people new IDs, and need to go "find" their prior pictures and get them renamed.

    mrod0442 - try this first - find out where on the network these images are stored, and manually rename one to the new name. If the prior empID was AB1234 and the prior image file was AB1234.jpg, and the new empid is CD5678, then rename the image file to CD5678.jpg. then check to see whether the picture is now available.

    If that works, then all you need is to rename the files using VBA.
    Here's the minimum code to rename files on a windows OS LAN using MS Access VBA as the driver.
    Code:
     Dim FSObj AS Object
     Dim strFromName AS string
     Dim strToName AS String
    
    ' create a FS object
       Set FSObj = CreateObject("Scripting.FileSystemObject")
    
    'iteratively set the from/to names and rename the file
       strFromName = "C:\PutThe\FileName\Here\FROMFILE.JPG"   
       strFromName= "C:\PutThe\FileName\Here\TOFILE.JPG"   
       FSObj.MoveFile strFromName, strToName
    
    ' explicitly destroy what you have created
      Set FSObj = Nothing

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Okay, so they probably aren't 'importing' the image, just the file location path. Whatever changes they make, better be done carefully.

    Does the stored path include the filename or just up to the target folder?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    My assumption from the initial description is that the import function imports a file from some device and saves it in "the usual place", and the button to change the employeeID executes code to change the name of the file in that same place.

  7. #7
    mrod0442 is offline Novice
    Windows XP Access 2013
    Join Date
    Oct 2013
    Posts
    3

    I added pics of what the layout looks like

    The database contains student information, where would I find in Access the action or code that controls the button to "CHANGE ID". A MILLION THANKS to all for your help and input. Also the data is imported first into the program, then we take a picture and save it to a folder, once we import the picture to a specific student the program renames the Image to the Student ID number. If I change the ID number in the Access table, the image disappears from the View window because it has the original ID number.

    Quote Originally Posted by mrod0442 View Post
    Hello Newbie here, so I have this program that we use for ID pictures. Through the program we have the persons info and assigned ID number, when we import an image to his profile the program changes the name of the actual image to his ID number. In the program itself there is an button to change the ID number very easily, individually. My question is how can I change the ID numbers for 1600 people through the ACCESS, since it is an ACCESS program. When I change the number in the subjects table it shows the change when I open the Program but the image no longer shows up because the ID number is different. Any help would be appreciated and I have ACCESS 2013. Thank you.

    Click image for larger version. 

Name:	PROGRAM LAYOUT.jpg 
Views:	10 
Size:	88.2 KB 
ID:	14183Click image for larger version. 

Name:	ACCESS VIEW.jpg 
Views:	10 
Size:	75.9 KB 
ID:	14184

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Is that 'program' an Access database with file extension of mdb or accdb? If it's mdb/accdb you should be able to do design edits and that includes modify code. If it is an mde/accde you cannot do design edits.

    If design tools do not show on ribbon, open the 'program' with shift key held down. This bypasses any automatic code and exposes the full ribbon and navigation pane. Find the form in navigation pane, open it in Design view. Click on the Change ID button. On the Property Sheet, look for the Click event, click the ellipses (...) next to the event. This will open the VBA editor in the Click event procedure. Edit code as needed.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    mrod0442 is offline Novice
    Windows XP Access 2013
    Join Date
    Oct 2013
    Posts
    3
    The file is an mdb file and I will try everything you just mentioned, thanks so much. I will post my results soon, thanks.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Sorry, I should have mentioned if the code is VBA, the event property will likely show [Event Procedure]. If it's a macro it could show [Embedded Macro] or it could be calling a VBA function or possibly a general macro. I don't use macros.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 04-24-2013, 11:50 AM
  2. Contact Picture keeps changing
    By trumpetman in forum Access
    Replies: 1
    Last Post: 11-27-2012, 02:41 PM
  3. Replies: 4
    Last Post: 06-08-2012, 12:35 PM
  4. Help me - attached file
    By uronmapu in forum Access
    Replies: 9
    Last Post: 06-06-2012, 08:34 AM
  5. Attached Files
    By tcheck in forum Access
    Replies: 1
    Last Post: 08-11-2011, 09:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums