Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2007
    Posts
    18

    Unanswered: The action or method requires a File Name arguments.

    Hi,
    In my adp i m trying to transfer a file to .CVS. its working good.
    but when i click cancel instead of 'Ok' on dialog box it give me.
    "The action or method requires a File Name arguments."
    My code is


    DoCmd.TransferText acExportDelim, , "qryExport", dhFileDialog("C:\", "CSV Files(.csv)", , , "School_Export" & strDt & ".csv", "Save File", , False), True


    is there anything wrong in it.

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Maybe you need to test to see if strDt is null or empty or test against the dialog box itself to see if cancel is clicked (or before opening the dialog box, put an on error goto Done and put a Done: label after the docmd.transfer...statement.).
    Last edited by pkstormy; 08-13-07 at 20:28.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    you may need to run the file dialog as a separate line to get the filename the user wants
    then use that file name in the docmd......

    id also check the documentation on the TransferText in the help file or intellisense prompt.
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Jul 2007
    Posts
    18
    I didnt really get that..????

    Could please write some code to make that clear.

    Thanks

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    rather than do it all on one line split it
    the call to the file dialog, then test the filedialog has returned a valid file (I think you need to check if the user pressed the cancel. if they have selcted a valid file then pass that to you do cmd
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Jul 2007
    Posts
    18
    Problem solved

    i Used
    Err_cmd_Export_Excel_Click:
    If Err.Number = 94 Then
    Else
    MsgBox Err.Description
    End If

    where 94 is error number of :"Invalid use of Null"
    Thanks for your help

Posting Permissions

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