Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA Coding (2000)

    Hello I have a form for user selection to run a number of reports. The form has a few tabs and I use 'case' for the tabs inn in my coding. I need the buttons to either view the report selected or to e mail through sendobject, I plan to do the this bit with a checkbox but having played around I am struggling to get it to run. This is my code as it stands....

    Private Sub Command3_Click()
    On Error GoTo Err_Command3_Click

    Dim stDocName As String
    Dim stDocName1 As String
    stDocName = "RptCCWorkGroup"
    stDocName1 = "RptTccWG"



    Select Case tabA.Value
    Case 0 ' first tab
    DoCmd.OpenReport stDocName, acPreview
    Case 1 ' second tab


    DoCmd.OpenReport stDocName1, acPreview




    End Select

    Guidance would be appreciated please.

    Thanks Darren.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VBA Coding (2000)

    Say that you have a check box chkMail that the user ticks if the report is to be e-mailed. In the example below, I use one variable to store the report name.

    Dim stDocName As String

    Select Case tabA.Value
    Case 0
    strDocName = "RptCCWorkGroup"
    Case 1
    strDocName = "RptTccWG"
    End Select

    If chkMail Then
    DoCmd.SendObject acSendReport, stDocName, acFormatHTML, ...
    Else
    DoCmd.OpenReport stDocName, acViewPreview
    End If

  3. #3
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Coding (2000)

    That's spot on Hans,

    Cheers Darren.

Posting Permissions

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