Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Else if bungled (Access 2000)

    Can somebody help me with the Else If condition? I am confused.I need to build a function that asks the following questions

    1. Shall i delete? If yes delete, if not proceed further
    2. If i do no delete shall i print the document?
    If yes, then it should ask print original or print not original?
    if print original then an other code must be executed namely "visible invoice" and then the function Fncprint
    if not original then open the report in preview and then execute the fucntion Print

    3. If i do not want to delete nor to print,do i just open in preview mode?
    if yes then i must ask original or not
    if original then i must add the function visible invocie

    However, when i want just to open the report, the function executes a print command.I am afraid my end if clauses are
    so confused that i canotn see what is wrong.
    Can somebody advise me of a better way for doing it?

    Below is my function:


    Public Function ProcessInvoice()
    ' the function is placed in the control CmdInvoices being the output for the ListInvoices
    Dim f As Form
    Set f = Forms![main]

    If IsNull(f![list].Visible = True
    Else
    DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
    VisibleInvoice
    End If
    If intPrint = vbYes Then
    FncPrint
    End If
    End If
    End If
    End Function

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

    Re: Else if bungled (Access 2000)

    This is your function with proper indentation:

    <img src=/w3timages/blueline.gif width=33% height=2>

    Public Function ProcessInvoice()
    ' the function is placed in the control CmdInvoices being the output for the ListInvoices
    Dim f As Form
    Set f = Forms![main]

    If IsNull(f![list].Visible = True
    End If

    Apart from that, your code seems OK (of course, I don't know what the procedures being called do). Try single-stepping through the code, or setting a stop on If intPrint = vbYes Then. See what the value of intPrint is (vbYes = 6, vbNo = 7).

  3. #3
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thank you !!!!!

    Dear Hans,


    Thank you so much for your reply which after i applied it, my code works excellent!!!!
    Could you help with one very similar function called ProcessOrder and here again i have the same problem,
    when i choose the preview the document, i print it.

    Thank you so much in adcance fro your wonderful remarks !!!!!!!!

    Here is my function as follows:






    Public Function ProcessOrder()
    ' the function is placed in the control CmdOrders being the output for the ListOrders
    Dim f As Form
    Set f = Forms![FOrderInformation]
    If IsNull(f![list]
    Dim intPrint As Integer
    Dim intAnswer As Integer
    intAnswer = MsgBox(" Delete? ", vbQuestion + vbYesNo)
    If intAnswer = vbYes Then
    Application.Echo False
    CancelOrder
    Else
    Dim intTrst As String
    intTrst = MsgBox(" Transform? ", vbQuestion + vbYesNo)
    If intTrst = vbYes Then
    ftransform
    Else
    intPrint = MsgBox(" Print? ", vbQuestion + vbYesNo)
    If intPrint = vbYes Then
    direct ' this function prints 4 copies
    Else
    DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
    VisibleOrder
    End If
    End If
    End If
    End If
    End Function

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

    Re: Thank you !!!!!

    It's nice that ProcessInvoice works now, but I don't know why, for I didn't change anything in the logic of your function...

    I can't see anything wrong with ProcessOrder either (again, I don't know what the procedures called from it do), so I'll just post it back with proper indentation.

    <img src=/w3timages/blueline.gif width=33% height=2>

    Public Function ProcessOrder()
    ' the function is placed in the control CmdOrders being the output for the ListOrders
    Dim f As Form
    Set f = Forms![FOrderInformation]
    If IsNull(f![list]
    Dim intPrint As Integer
    Dim intAnswer As Integer
    intAnswer = MsgBox(" Delete? ", vbQuestion + vbYesNo)
    If intAnswer = vbYes Then
    Application.Echo False
    CancelOrder
    Else
    Dim intTrst As String
    intTrst = MsgBox(" Transform? ", vbQuestion + vbYesNo)
    If intTrst = vbYes Then
    ftransform
    Else
    intPrint = MsgBox(" Print? ", vbQuestion + vbYesNo)
    If intPrint = vbYes Then
    direct ' this function prints 4 copies
    Else
    DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
    VisibleOrder
    End If
    End If
    End If
    End If
    End Function

Posting Permissions

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