Results 1 to 8 of 8
  1. #1
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37

    Saveas function

    I am using a string of code that saves a file under the workorder name. I need it also save it the date stamp which is a text box on my form. For example I would like it to save something like this... WO2534-9/3/90
    Here is the code I have so far...


    objXLBook.SaveAs ("I:\Dept\AA-QMM-NA\Shared\APC\Inprocess_Final\Red_Tags\" & Me.WO_ORDER__.Value & ".xls")

    Thanks for the help

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    The slashes would be invalid as a file name.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37
    I figured as much but I could use an ID number as well. Just something to distinguish one from another if there are multiple of the same number. Basically I need to know how to reference two different text boxes

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Just keep concatenating:

    Code:
    objXLBook.SaveAs ("I:\Dept\AA-QMM-NA\Shared\APC\Inprocess_Final\Red_Tags\" & Me.WO_ORDER__.Value & Me.OtherTextboxName & ".xls")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37
    Thanks baldy, that worked. Is there any way I could add an underscore between the too so its not just a massive number? I tried & me.order & "_" & me.ID & and that didnt work...

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    That should work fine. What does "didn't work" mean? If you got an error, what was it? You might try Debug.Print (prints to the VBA Immediate window) or a message box so you can see what the code is trying to use:

    Code:
    Debug.Print "I:\Dept\AA-QMM-NA\Shared\APC\Inprocess_Final\Red_Tags\" & me.order & "_" & me.ID & ".xls"
    You can examine the result to make sure it will be a valid path and file name.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    reidn is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    37
    I got it working. The problem was there was one I had to replace buried in the code that I didn't see. Thanks for the help

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. DDE Function gone?
    By djcomlab in forum Programming
    Replies: 7
    Last Post: 11-23-2010, 11:01 AM
  2. if function
    By lolo in forum Queries
    Replies: 1
    Last Post: 08-01-2010, 11:38 PM
  3. saveas in access vba
    By philfer in forum Programming
    Replies: 2
    Last Post: 05-20-2010, 12:02 PM
  4. SaveAs Dialogue box
    By saqqer in forum Programming
    Replies: 8
    Last Post: 09-10-2009, 10:49 AM
  5. Want function to get current function name
    By Davis DeBard in forum Programming
    Replies: 2
    Last Post: 08-13-2009, 05:02 AM

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