Results 1 to 5 of 5
  1. #1
    JFo is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    393

    Using different validation on dynamic controls

    Here is a copy of my current database


    Attachment 4780

    If you go through frmMainMenu-->Select relevant combos and click on Add new Inspection-->fill in relevant details-->Add Equipment-->select equipment from combo box-->click in checklist form

    The check-list form is populated with the questions for that specific piece of equipment type

    What I want to be able to do is to validate the different answers with different coding. At the moment the answer is set up as a combo box, however ideally someone could enter anything they wanted as a response and different questions should be validated with different validation i.e whether a date, or a serial number was entered for example

    Wondering if anyone knows how to do this for each question in the current set-up?

    Would love an example of how to do it for two specific questions with different validation ie dtae and serial number and I can maybe figure out how to do it for the rest


    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,631
    You want users to always select answer from a standardized set of responses? You can restrict their choice according to the Equipment selected. Equipment can be restricted according to the Type selected. These are cascading (dependent) comboboxes. See this tutorial http://www.datapigtechnologies.com/f...combobox2.html

    Set the dependent comboboxes as not Enabled until primary combobox selection is made then use code to Enable.

    Otherwise will need to hard code the validation with Select Case and/or If Then Else structures.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    JFo is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    393
    Hi June7, thanks for checking out my problem

    You want users to always select answer from a standardized set of responses? No they should be able to enter unique answers for any question however the common answers exist to save time

    Thanks again for your response however I have already used many cascading combo boxes to get to my current position and every question has been filtered for the specific piece of equipment type.

    What I need to be done will have to be handled in code you are correct, my difficulty is coding something like this and where to put it the code

    for example to enforce a valid response is entered will have to be something like

    Dim Answer As String
    Dim testcheck As Boolean

    if equipment type = 'a'
    AND ChecklistID (Question) = '51'
    testcheck = Answer = "B?T*"

    This is not correct however theoretically something like this will return false if the answer does not start with a B or end in a t

    I would like to be able to do some sort of validation if required on each answer however due to the fact I am dynamically populating the form I don't know where to put this code

    Thanks

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,631
    Not sure I understand your requirements but will take a stab. Perhaps in the BeforeUpdate event of the answer combobox, something like:
    If Me.tbxEquipmentType = "A" AND Me.tbxChecklistID="51" Then
    If Not Me.cbxTestCheck Like "B*" And Not Me.cbxTestCheck Like "*T" Then
    Cancel=True
    EndIf
    ElseIf
    ....
    End If
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    JFo is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    393
    U made my day June7, thanks

    I got it to work finally, Great!!!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Dynamic Form, Dynamic labels/ captions?
    By JFo in forum Programming
    Replies: 15
    Last Post: 10-12-2011, 08:33 PM
  2. Dynamic Data
    By top1hat19 in forum Access
    Replies: 4
    Last Post: 02-14-2011, 06:32 PM
  3. Dynamic With Statement
    By swalsh84 in forum Programming
    Replies: 10
    Last Post: 09-09-2010, 12:35 PM
  4. Dynamic reporting
    By pushpm in forum Programming
    Replies: 0
    Last Post: 04-22-2009, 12:45 PM
  5. help with dynamic hyperlink to pdf
    By iresolver in forum Access
    Replies: 0
    Last Post: 12-24-2008, 01:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums