Results 1 to 4 of 4
  1. #1
    mcktigger is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    19

    Looping Through Controls to Check Values

    Hi hoping someone can help with this

    I have a number of products on a form where the user selects "Yes" in a combo box to indicate if they want special prices for that product. If they select yes then they need to enter the qty. They can do this for multiple products. Once finished they click a link (Submit Request) which sends an email to their manager requesting authorisation (this part all works fine)

    What I want to do is check if any of the combo boxes are set to Yes but a zero or Null is entered in the any of the corresponding qty fields, the Submit Request link is automatically disabled until each qty is completed. I think I need to do a DO WHILE or FOR EACH loop but not sure how to do this or where I would put the event.

    I hope this makes sense. Really appreciate any help.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Are your items in a bound or unbound form, and are they in a subform or are they on the main form. The method really relies on how you're storing your data and what your user interface looks like.

    For instance if you're using an unbound control that you could make use of the TAG property to check if values meet a certain criteria. If you're going to be cycling through items in a subform you'd likely want to create a dynamic dataset and cycle through those records.

  3. #3
    mcktigger is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2011
    Posts
    19
    Hi

    They are on a bound form. Not in a subform but they are on a tabbed page.

    Thanks

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    on the button that sends the request you'd just have to have something like this

    Code:
    dim sMsg as string
    sMsg = ""
    if Special_Price1 = "Yes" and nz(Special_Price1_Qty) = 0 Then sMsg = "Value missing for Special Price Marked yes on Item " & <field name with special price item description> & vbcrlf
    blah blah for each check
    
    Msgbox "Can not forward order.  These items are in error: " & vbcrlf & vbcrlf & smsg
    I don't know how your form is set up but you can do some things to mitigate the amount of code you have to write but i"d have to see a sample of the database to go in that direction.

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

Similar Threads

  1. Replies: 2
    Last Post: 08-28-2012, 03:43 PM
  2. Replies: 2
    Last Post: 08-07-2012, 02:02 PM
  3. setting values of multiple controls
    By desimoreno in forum Forms
    Replies: 9
    Last Post: 12-14-2011, 02:54 PM
  4. Replies: 2
    Last Post: 10-27-2011, 10:28 AM
  5. Check Box Values in Queries
    By Rubz in forum Queries
    Replies: 3
    Last Post: 04-16-2010, 11:26 AM

Tags for this Thread

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