Results 1 to 5 of 5
  1. #1
    injanib is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    67

    Combobox Based on a Query

    Hello all,



    On a form two of my fields are comboboxes, cboTerm and cboClass.
    I use this form to register students in a class. The cboTerm is for the name of the semester and its row source is a table. The cboClass contains the name of the classes and its row source is a query that is based on multiple tables (tblClass, tblTerm, tblStudents).
    the tblStudent has a field called EligibilityLevel, which is a number field.

    In the query that serves as the row source of cboClass, I had a criteria in the TermID field from the tblClass. The criteria was this:

    Like [txtTermID] & "*"

    the after update event of the cboTerm requerried the cboClass, and the cboClass only displayed the classes that are being offered in the selected term by the above criteria. This worked perfectly fine and if I navigated between the records, the value of the cboClass displayed for each record.

    I decided to add another criteria based on the students' eligibility so that the cboClass only displayed the classes that are offered in the selected term and also for which the students are eligible.
    I added the criteria under the EligibilityLevel field of tblClass in the query as follows

    >=[txtEligibilityLevel]

    This works if I am entering a new record, but when I navigate back to the records, the cboClass is blank. And therefore it throws off all my other codes, because of the blank fields.

    Can someone tell me what I am doing wrong?

    Thank you in advance.

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Try throwing in a:
    Me.cboClass.Requery in the AfterUpdate section of whatever control it is you use to enter the data.

  3. #3
    injanib is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    67
    Thanks for the reply. I already have that on the AfterUpdate event of the first combobox. As I mentioned, the combobox is requeried fine when I am entering new records. It is only when I navigate back to the record, the combobox goes blank and so does the unbound fields that get their values based on this combobox.

    I even tried the requery on the forms Current event to requery the combobox for the old records, but that didn't help either.

    Any other suggestions?

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Not sure. Sorry =/

  5. #5
    injanib is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    67
    I think the problem is with the Less than sign. It works with the equal sign or "Like", except of course I don't get the result I want.

    I seems the less than or greater than works fine in a query criteria if referred to a given number or a field in the query, but not with an control on a form.

    Any idea? is there another way to express "less than" in a query criteria?

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

Similar Threads

  1. Query based on combobox
    By scotty562 in forum Queries
    Replies: 6
    Last Post: 11-11-2010, 08:49 AM
  2. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  3. Replies: 0
    Last Post: 12-16-2009, 01:14 PM
  4. Query based on Value in a Combobox
    By martinwd in forum Queries
    Replies: 3
    Last Post: 06-02-2009, 02:21 PM
  5. query based on two combobox
    By datto in forum Queries
    Replies: 0
    Last Post: 04-18-2007, 11:10 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