Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2007
    Posts
    18

    Unanswered: Getting data from a form during validation

    Can anyone give me some direction with the following? I have an application that validates data between two tables. When I encounter an invalid or missing name for example, I want to activate a form, allow the user to enter the data, write it to the appropriate table and carry on with the processing. It would be just as easy to add it to the appropriate table at the time of the error but, I am just following the specs. that were given to me. In advance, thanks for your help.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    How does it validate the data between the tables? Is this some sort of SQL query?
    Is this a process written in VBA?

    I think you need to provide more information before a helpful answer can be formulated
    George
    Home | Blog

  3. #3
    Join Date
    Apr 2007
    Posts
    18
    Sorry. It is using VBA code to do the validation.

    rsCustomers.MoveFirst
    Do Until rsCustomers.EOF

    If IsNull(DLookup("[ClientName]", "tblClients", "[ClientName] = '" & rstCustomers!ClientName & "'")) Then

    [This is where I want to branch to a form to have the data entered and return to procss the next record.]

    End If

    rsCustomers.MoveNext

    Loop

    Thank you.

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Fancy posting your open recordset and close recordset code too?
    Include all variable declarations etc!
    George
    Home | Blog

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I've done this before but I have the code at work. Basically what I did was Dim a global variable (i.e. NewText) above a function which is called to do the validation. If it finds some bad data, it opens a form (like this the following) Where NewText is written to from the opened form and when closed, the function resumes checking to see if NewText has a value in it.

    Dim NewText as variant

    Public Function DataTest()
    ....
    ....
    if rs!SomeField <> "Value it's supposed to be" then
    docmd.openform "BadDataForm", , , , , acDialog
    if NewText <> "" then
    'write NewText here or pass back to writing procedure the NewText
    rs!SomeField = NewText
    end if
    end if
    ....
    ....

    end Function
    Last edited by pkstormy; 05-28-07 at 18:20.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  6. #6
    Join Date
    Apr 2007
    Posts
    18
    Your information was very helpful.
    Thank you.

Posting Permissions

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