Results 1 to 4 of 4
  1. #1
    Kaba is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    2

    Query Not Seeing Text on Form Field?

    This is really confusing me. I'm trying to reference data on an open form and use it as criteria in my query and for some reason it's not returning any records.

    I have the unbounded form opened with unbound combobox (cmbOOffice) populated. However, the query is not returning any data when I know for a fact there is at least one record in the tblMainCase table where OriginOffice matches the current text displayed in the cmbOOffice field on the splash form.
    SELECT tblMainCase.*, tblMainCase.OriginOffice, tblMainCase.CaseType, tblMainCase.Client
    FROM tblMainCase
    WHERE (((tblMainCase.OriginOffice)=[Forms]![splash]![cmbOOffice]))
    ORDER BY tblMainCase.Client;
    When I replace [Forms]![splash]![cmbOOffice] with "New York", it returns the record. On the other hand, even though "New York" is displayed in the cmbOOffice field, it wont. I think for some reason the query is not picking up on the data in the field. Why is this? Am I missing something?



    Thanks for any help

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    When I replace [Forms]![splash]![cmbOOffice] with "New York", it returns the record. On the other hand, even though "New York" is displayed in the cmbOOffice field, it wont. I think for some reason the query is not picking up on the data in the field. Why is this? Am I missing something?
    What is the row source of the combo box "cmbOOffice"?

    If the bound column (usually the first column is the bound column and it *usually* is the primary key, a long integer) is not a text field, then it would make sense that no records are returned.

    This would be the first thing I would check since the query returned a record when a text string was substituted.

  3. #3
    Kaba is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    2
    RowSource = SELECT tblMainCase.Matter, tblMainCase.OriginOffice FROM tblMainCase ORDER BY tblMainCase.OriginOffice;

    Bound Column = 1

    Again, the ComboBox is displayed just fine with the expected data. It's the query that references it that somehow don't see the displayed text/data.

    Thanks for the help. Much appreciated.

  4. #4
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by Kaba View Post
    RowSource = SELECT tblMainCase.Matter, tblMainCase.OriginOffice FROM tblMainCase ORDER BY tblMainCase.OriginOffice;

    Bound Column = 1

    Again, the ComboBox is displayed just fine with the expected data. It's the query that references it that somehow don't see the displayed text/data.

    Thanks for the help. Much appreciated.

    If "OriginOffice" is the field that contains "New York", then try:
    Code:
    SELECT tblMainCase.*, tblMainCase.OriginOffice, tblMainCase.CaseType, tblMainCase.Client
    FROM tblMainCase
    WHERE tblMainCase.OriginOffice = [Forms]![splash]![cmbOOffice].Column(1)
    ORDER BY tblMainCase.Client;
    I am curious as to why you have "OriginOffice", "CaseType" & "Client" fields in the query twice. When you have "SELECT * FROM....", "SELECT *" means to include all fields. The "*" is a wildcard in Jet SQL.

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

Similar Threads

  1. Replies: 1
    Last Post: 08-04-2011, 04:17 PM
  2. ID field autofilling text field on another form
    By ledmark in forum Programming
    Replies: 0
    Last Post: 03-24-2011, 10:12 PM
  3. Synchronisizing Sub-Form field To Text-Box
    By vdanelia in forum Forms
    Replies: 2
    Last Post: 03-01-2011, 02:54 PM
  4. Replies: 2
    Last Post: 05-05-2010, 02:52 PM
  5. Replies: 1
    Last Post: 10-09-2008, 04:48 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