Results 1 to 5 of 5
  1. #1
    Join Date
    May 2004
    Posts
    63

    Unanswered: Validation Function

    I have function to do validation of data. I have use that function for my Navigation button. When ever user is on new record and when the user clicks on Privious wihtout inputing any data it calls the Validation function to see if all data is validated. But this could also happen if user clicks on "CmdNew" by mistake and then click on "cmdPreivious" to go back it still calls the validation function.

    Is there anyother way to handle this situation ?



    Code:
    Private Sub cmdPrevious_Click()
    
    If IsDataValid Then
        DoCmd.GoToRecord acForm, "frmMain", acPrevious
        Me.TabStudyTeam.Value = 0
    End If
    
    End Sub

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    Put an On/Off static flag in your validation function. Then set this flag to true or false depending on your needs and check its status in the validation function. For example whenever the user clicks on cmdNew you could set the flag to false, if they then click on previous the datavalidation function will not run. This is an idea, modify it to fit your needs.
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    May 2004
    Posts
    63
    How do i set the flag ? Can you give me an example ?

  4. #4
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    For example in your module add:

    Private blnOnOff as Boolean

    In your cmdNew function add:

    blnOnOff = True

    Or

    blnOnOff = False
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  5. #5
    Join Date
    May 2004
    Posts
    63
    I'm very new to VBA.......Did you want me to add this to the 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
  •