Ignore to save data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • solargovind
    New Member
    • Mar 2007
    • 41

    Ignore to save data

    Hi,

    This question i hve asked in this forum already. They asked me to set Required property of field to Yes in Table design.

    It was working fine. But, it is not convenient to me. So, I tried to put in the the below code which also allows me to stores the data.

    --------------------

    In the Command_Click() event..

    Dim response

    response = MsgBox("Are you sure want to Exit?", vbYesNo, "Payment Creation")

    If response = vbYes Then
    If IsNull([Paid_by_id]) Or IsNull([Received_by_id]) Or IsNull([Remarks]) Or IsNull(Form_Pay ment_Detail.Reg ion) Or IsNull(Form_Pay ment_Detail.Acc ount) Or IsNull(Form_Pay ment_Detail.Ven dor) Then
    Me.Undo
    DoCmd.Close acForm, "Payment_Creati on"
    Else
    End If
    Else
    End If
    --------------------

    Any idea..how to ignore to save the data...? ie., i should avoid to store if the data is incomplete.

    Pls.suggest me.


    Note : Form_Payment_De tail.Region is Subform control.

    Thanks in advance.

    ngr.
  • cyberdwarf
    Recognized Expert New Member
    • Nov 2006
    • 218

    #2
    Hi

    Use this:-

    Code:
    docmd.Close acForm, "Payment_Creation",acSaveNo
    You can then lose the "Me.Undo" line as well

    HTH
    Steve

    Comment

    • solargovind
      New Member
      • Mar 2007
      • 41

      #3
      Originally posted by cyberdwarf
      Hi

      Use this:-

      Code:
      docmd.Close acForm, "Payment_Creation",acSaveNo
      You can then lose the "Me.Undo" line as well

      HTH
      Steve
      ========

      Hi,

      Thanks for your answer.

      I tried with your above suggestion. But...Even then..its not working...

      Believe you hve understood already that i hve Autonumber field in my form whicy may causes problems

      when i enter second field, the Autonumber fields get generated. It may give problems.

      How to avoid even if the Autonumber field get generated..?

      Believe its clear.

      Any suggestion would be greatly appreciated.... ?

      Thanks in advance.

      ngr.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Originally posted by solargovind
        ========

        Hi,

        Thanks for your answer.

        I tried with your above suggestion. But...Even then..its not working...

        Believe you hve understood already that i hve Autonumber field in my form whicy may causes problems

        when i enter second field, the Autonumber fields get generated. It may give problems.

        How to avoid even if the Autonumber field get generated..?

        Believe its clear.

        Any suggestion would be greatly appreciated.... ?

        Thanks in advance.

        ngr.
        You'd have to delete the record.

        Comment

        Working...