Results 1 to 3 of 3

Thread: code help

  1. #1
    Join Date
    Dec 2011

    Unanswered: code help

    Hello all, I suck a coding, only been using MS access for about a month or so, so far I managed to create this code:Private Sub Command17_Click()


    Dim stDocName As String

    stDocName = "admin_rptOperator Log"
    DoCmd.OutputTo acReport, stDocName, acFormatPDF, "L:\Operations\Team Managers\" & DatePart("yyyy", Date_of_Log) & " Operator Log\ " & Employee_Name & ".pdf"

    Exit Sub

    MsgBox Err.Descriptionq
    Resume Exit_Command17_Click

    End Sub

    I have 1 issue/ 1 questions:

    issue 1- the code works great, it saves the file withthe employee name to the correspondent folder (2012 etc..) issue here is if on my form i input something from this year (2012) it saves it great but it also saves everything from 2011 on the same file (employee_name.pdf with all his records from past and present year) all i want to accomplish is for it to save the files from 2011 on the 2011 folder and 2012 on its folder with the same employee name but different year records.

    questions: is there a way that i can add something to the current code above that will make MS Access create a folder automatically with the employee name and save the employee file inside with his record ( that way seems easy for me because i can have access save the employee record with the file id at the end on its own folder as individual files)

    any help will be appreciated.

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    The MkDir instruction creates a folder at the specified location:
    MkDir "C:\Documents and Settings\Sinndho\My documents\Access\NewFolder"
    Have a nice day!

  3. #3
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    Just out of curiosity, what are you attempting to do with this line of code:


    I ask because Refresh is frequently misunderstood. Directly from Access Help:

    The Refresh method immediately updates the records in the underlying record source for a specified form or datasheet to reflect changes made to the data by you and other users in a multiuser environment.

    The Refresh method shows only changes made to records in the current set. Since the Refresh method doesn't actually requery the database, the current set won't include records that have been added or exclude records that have been deleted since the database was last requeried. Nor will it exclude records that no longer satisfy the criteria of the query or filter. To requery the database, use the Requery method. When the record source for a form is requeried, the current set of records will accurately reflect all data in the record source.

    Linq ;0)>
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts