Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Expected End of Statement?

    Hi,

    Below is a snipet of code I'm working on.

    My idea: I would like to take a table add a date to the name of the table then export it to Excel.

    Everything seems to be fine, except I continue to get this msg "COMPILE ERROR--Expected: End of Statement". This part of the code is highlighted when the error occurs ("PH_Labor"

    Codeim strDate As Date
    strDate = Date - WeekDay(Date - 6) - 14

    ' DoCmd.OutputTo acTable, "PH_Labor", acFormatXLS,"G:UsersProjschdHistory ArchivesArchive History Lab("PH_Labor" & strDate.xls) ", True

    Can someone please tell me why?

    Thanks,

    Roberta Newton
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  2. #2
    Star Lounger
    Join Date
    Feb 2001
    Location
    Wirral, Merseyside, Merseyside, England
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expected End of Statement?

    A couple of obvious things you are trying to save a file name with / in, so that wont be acceptable plus you are trying to turn a date variable into a string.

    Try:-

    Dim strDate As Date
    Dim MrVar As String

    strDate = Date - WeekDay(Date - 6) - 14
    MrVar = Format(strDate, "DDMMYY") & ".xls"

    DoCmd.OutputTo acTable, "PH_Labor", acFormatXLS,"G:UsersProjschdHistory ArchivesArchive History Lab("& "PH_Labor" & strDate &") ", True

  3. #3
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expected End of Statement?

    Ok...I tried that and got the following msg.

    "Labor and Expense History can't save output date to the the file you've selected......."

    I tried this:

    DoCmd.OutputTo acTable, "PH_Labor", acFormatXLS, "G:UsersProjschdHistory ArchivesArchive History LabPH_Labor & strDate.xls ", True

    and it works...but puts the name as "PH_Labor & strDate but should be "PH_LABOR4/6/01". The () around PH_Labor....combines the NAME and strDate.

    This works for renaming purposes...but not for Output purposes?????
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expected End of Statement?

    I think that what you want is:

    <pre>DoCmd.OutputTo acTable, "PH_Labor", acFormatXLS, "G:UsersProjschdHistory ArchivesArchive HistoryLabPH_Labor" & strDate & ".xls", True
    </pre>

    Legare Coleman

Posting Permissions

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