Results 1 to 6 of 6

Thread: DoCmd

  1. #1
    Join Date
    Feb 2004
    Location
    Swindon, UK
    Posts
    86

    Unanswered: DoCmd

    how can i get the following. the normal line would be as follows

    Docmd.OpenReport RptName, acPreview

    but what i need is for the line to be

    Docmd.TextBox1.Value

    where the value in my textbox is 'OpenReport RptName, acPreview'

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Eh... I don't think you can do that... As far as I know, DoCmd does not support string parameters for the method.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Feb 2004
    Location
    Swindon, UK
    Posts
    86
    thats the problem, i have a form with about 40ish buttons which run different reports. at present it just views them, but i have been asked to add options to Print, send, or view. so i have option buttons at the top and which ever is selected it puts the 'OpenReport RptName, acPreview','OpenReport RptName, acNormal' or 'OutputTo acReport, RptName' into a text box. which then i need the DoCmd.textbox1.value.

    i could have done it as DoCmd.OpenReport RptName, textbox1value for printing and viewing, but the problem comes when someone needs to send the report as it is a different method

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    uhh...

    Mang you're making this really hard...

    There's a whole bunch of ways you could do this a little easier.

    One would be to create a function that would accept a string and integer parameter. Then pass the name of the report, and an integer representing the option box selection.

    Another, even easier method would be to create a context menu for your reports, so the user can right click on the report and choose to do whatever they want with it. They actually already have that ability, but designing a custom context menu for them will make it more paletable.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    too true Teddy!

    i can imagine a split() on your textbox and then a series of select case and blah blah... what a pain!

    docmd.openreport nameOfReportFromACombo, appropriateConstantFromRadioGroup

    should do it tho.
    be a more natural interface as well!

    izy
    currently using SS 2008R2

  6. #6
    Join Date
    Feb 2004
    Location
    Swindon, UK
    Posts
    86
    cheers guys, works a treat

Posting Permissions

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