Results 1 to 2 of 2

Thread: Validation

  1. #1
    Join Date
    Jun 2006
    Posts
    48

    Question Unanswered: Validation

    I am working on the creation of a simple random number generator programme.

    I've created a form called frmRandom which has three combo boxes:
    first combo - contains the values Manager, Supervisor
    second combo - contains list of manager's codes
    third combo - contains list of supervisor's codes

    On frmRandom, there are subforms, e.g subformManager. In this subform, the user can click on the command button 'Generate Manager Random Number' and a random number will be displayed in text field 'textMgrRn'.

    I have to make sure the random number generated (in each subform) doesn't match the supervisor's or manager's code selected in the main form.

    I am thinking about the following for example, but do not know if I'm on the right track and where exactly to place it:

    If cboManager.value = subformManager.textMgrRn.value then
    Msgbox 'Please try again'
    End if


    Please help!

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Why not just regenerate a new random number automatically if the number is the same as that on the main form? That way you don't even need to show a message box.

    So you might have code like this....

    RandomLabelStart:
    ....code to generate random number here
    If RandomNumberVariable = cboManager.value then goto RandomLabelStart
    ....continue here by populating subformManager.textMgrRn.value with random number

    Otherwise you'll need to put your code with the test somewhere when the user clicks a "save" type button which saves the record (or goes to a new record). It's difficult to say where without knowing more info.
    Last edited by pkstormy; 02-15-08 at 01:27.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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