Results 1 to 7 of 7
  1. #1
    Star Lounger
    Join Date
    Jun 2002
    Location
    London, Gtr London, England
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Common Dialogue Control

    Hello.

    I am using the Common Dialogue Save As function within my application. The problem is, regardless of whether the user presses Save, or Cancel, the object saves the output.

    I need some code for the cancel option. Can anyone help?

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Common Dialogue Control

    jonathan,
    Not too sure about the Save as function that you refer to.
    Do you mean dlgMyCommonDialog.ShowSave ? If so use the control to return a string which is the UNC of the file that the user wants to create. then use the docmd.save command to save the required data to the file.
    To pick up on the Cancel possibility put an if statement after the strMyUNC = dlgCommonDialog.ShowSave like
    if strMyUNC = vbcancel then
    exit sub
    else
    docmd.save ...
    end if

  3. #3
    Star Lounger
    Join Date
    Jun 2002
    Location
    London, Gtr London, England
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Common Dialogue Control

    Cheers for the reply, but I am a little more confused.(I am using the ShowSave).
    What do you mean by UNC?

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Common Dialogue Control

    UNC - Universal Naming Convention
    anything that looks like "C:My Documentsfile...."
    basically a drivedirectoryfile location

  5. #5
    Star Lounger
    Join Date
    Jun 2002
    Location
    London, Gtr London, England
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Common Dialogue Control

    Still no joy.
    The Common Dialogue part is being used as an output for transferspreadsheet action, with the path to where the spreadsheet is to be saved to being the result from the common dialogue.
    I don't think the docmd.save will work for this.

  6. #6
    carl g.
    Guest

    Re: Common Dialogue Control

    Jonathon,

    The common dialogue must transfer a location to save the file to the transferspreadsheet action.

    What you need to do is to try to test whether this location hasn't been entered (i.e. "Cancel" has been clicked on the Dialogue box).

    The way that I am doing this is:

    If len("thelocation")=0 then
    Exit Function
    End if

    Regards,

    Carl

  7. #7
    Star Lounger
    Join Date
    Jun 2002
    Location
    London, Gtr London, England
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Common Dialogue Control

    The problem is that I build the filename for the user, specifying it as commondialog.FileName. I am not sure if the method you offered will work for me.

    I am looking at commondialog.cancelError now but struggling.

    Any more 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
  •