Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2003
    Posts
    12

    Unanswered: Can you kind people help me :)

    Hello,

    I'm by no means an access proffesional. I'm just a student who is completely stuck and has no experience with visual basic.

    Well here's the scenario:

    I have a database with a field which is a tickbox. Now what i need to do is that once that field has thirty boxes which are ticked i want it to bring up an error when you try and click a 31st tickbox...

    Please can you guide me on exactly how to do this ...

    - miSt

  2. #2
    Join Date
    Aug 2002
    Location
    Northampton, England
    Posts
    266
    Do you mean 30 check boxes on one form? cos' I can't see how one field can have 30 check boxes??

  3. #3
    Join Date
    Jan 2003
    Posts
    12
    No lol.

    Sorry i didn't explain probably.

    I have a table and one of the fields is a checkbox. Say if this was a field of users and if the box is ticked it means they're under 10 and if they're not under 10 it's unticked. Once i have 30 users who are under 10 i want it to display an error.

    I wish i could attach my database to make it easier...

    - miSt

  4. #4
    Join Date
    Oct 2002
    Location
    NSW Australia
    Posts
    61
    In the oncurrent event for the form do a Count of one of the fields with yourcheckbox = -1 as the criteria.

    eg.

    Private Sub Form_Current()

    If Dcount("[SomeUniqueID]","SomeTable","[SomeCheck] = -1") >30 then
    msgbox(" > 30 records have been created")
    else
    'do nothing
    end if

    End Sub

    You could also count thr records in a recordset object instead if you prefer to use SQL queries.

    HTH
    :0)

  5. #5
    Join Date
    Jan 2003
    Posts
    12
    Thankyou for your help.

    I don't really understand what you told me to do there but i'll show my tutor that link and see if she understands

    If she doesn't i'll reply asking for step-by-step instructions if you can do that for me

    Thanks !

    - miSt

  6. #6
    Join Date
    Jan 2003
    Posts
    12
    Ok my computing teacher doesn't really understand..

    Is there any chance i could email my database to someone and they inplement this for me?

    Thanks in Advance

    - miSt

  7. #7
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    you can email it to me if you want but first i'll try to explain the process

    bits of the code that are enclosed in <> need to be replaced with the words that are relavant to your database

    in your form open the properties window, go to the events tab and click on the 'on current' text area you should see a button labled '...' click it and choose the code option

    then change it to look like

    Private Sub Form_Current()
    If Dcount([<Name_of_the_Primary_Key_Field>], "<Table_Name>", "[<Name_of_the_Check_Box_Field>] = -1")>30 then
    msgbox("You have more than 30 checkboxes ticked")
    else
    'do nothing
    end if

    End Sub
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  8. #8
    Join Date
    Jan 2003
    Posts
    12
    Thanks for the advice but i couldn't get it working

    Can you PM me you email address then i can send it your way

    Thanks In Advance

    - miSt

  9. #9
    Join Date
    Dec 2002
    Location
    Columbus, GA
    Posts
    81
    If you havent figured this out, I had a similar form that does what yoru talking about and I may be able to help you out.

    I wasnt big on CODE at first so I know how code can confuse you. You can do it all through fields on the form itself.

Posting Permissions

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