Results 1 to 8 of 8
  1. #1
    mp3909 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    136

    Appending date to filename

    I'm looking into this database that someone had created.


    There is a table called tblImportFiles.
    I need to change the Filename for the second record in this table to a filename that appends the date. You get the date from a table called tblCDate that has a field calld COBDate.

    There is a function built inside the VBA editor called fDateInString that taks 2 parameters.
    A query called qsel_ImportFiles uses all of this to create this final output.

    Everytime I close and open the database the first thing I get is a message box saying Enter Parameter Value for qsel_ImportFiles.Filename.
    I don't get it because it doesn't ask this for the field called qsel_ImportFiles.Folder and that makes use of the VBA function fDateInString

    What is wrong please?
    Attached Thumbnails Attached Thumbnails Capture2.PNG   Capture3.PNG   Capture4.PNG  

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Everytime I close and open the database the first thing
    you get that prompt when opening, and again when closing? Opening makes some sense; not so much closing, unless code on form closing is involved.

    Possibly a particular form is set to open by default when the db opens and it is directly or indirectly causing your query to run - and that query is looking for a form field on a form that isn't open at the time.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    I wonder whether the code is having trouble with using # as part of your filename and filepath fields.
    Try editing those paths so there are no special characters and see if the code runs without asking for a parameter
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  4. #4
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    I agree with Colin, ampersands can cause havoc when used in file names, commas are a problem too.

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Quote Originally Posted by Gina Maylone View Post
    I agree with Colin, ampersands can cause havoc when used in file names, commas are a problem too.
    Ampersand is &
    Maybe you meant the hash or octothorpe?

  6. #6
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Well, duh. Pound sign? ## :-)

  7. #7
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Hi Gina
    Of course in the UK a pound sign is a £....
    Any special character such as & ' - will all cause difficulties but perhaps the # sign is the worst due to its use in dates.
    Having files or folders with #yyyymmdd# or similar as part of the name is asking for trouble.
    In fact I'm surprised its allowed but a quick check shows it can be done
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  8. #8
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    LOL! How confusing its all become :-)

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

Similar Threads

  1. Replies: 8
    Last Post: 07-18-2019, 01:36 AM
  2. Replies: 14
    Last Post: 11-27-2018, 06:31 PM
  3. Replies: 2
    Last Post: 02-07-2018, 01:53 PM
  4. Looking for timevalue in filename
    By JeroenMioch in forum Access
    Replies: 4
    Last Post: 01-22-2016, 12:30 PM
  5. Date and time in filename
    By frankesjoberg in forum Import/Export Data
    Replies: 1
    Last Post: 03-02-2010, 12:35 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