Results 1 to 6 of 6
  1. #1
    breakingme10 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Oklahoma
    Posts
    153

    Question Combo List Values to Ignore Certains Records

    I need some help

    I have a several tables but the ones i'm working on now are: Company, LeaseSites, and Water Tickets.

    I have several lease sites that go to Newfield that have the same name as sites for other companies but they are in different locations.

    We have two separate people that do the billing. 1 gets all the Newfield 2 Gets all the other companies. I am working on how to best filter this for the two. The actual water tickets have all the information on them that the table "Water Tickets" has. 28 Fields. A lot of information. I have the drivers in their own table, the trucks in their own table (the same driver doesn't always get the same truck each time).. How can I tell it to query only newfield vs all other companies.

    LeaseSites looks like this:
    Click image for larger version. 

Name:	leasesites.PNG 
Views:	11 
Size:	44.1 KB 
ID:	15087



    Company:
    Click image for larger version. 

Name:	Company.PNG 
Views:	11 
Size:	31.8 KB 
ID:	15086
    Water Tickets:

    InvoiceNum Newfield TicketDate Time1 Time2 Time3 Time4 BillTo Lease Sec T R County Origin Destination Product StartGauge1 StopGauge1 StartGauge2 StopGauge2 StartGauge3 StopGauge3 Service Remarks Driver TruckNum Barrels Hours
    (YES/NO)

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    How are you populating the field "LeaseCompany" in your table "LeaseSites"? I see a name and a PK

  3. #3
    breakingme10 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Oklahoma
    Posts
    153
    SELECT [Company.CompanyName] & " " & [Company.Company_ID] AS LeaseCompany FROM Company;

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    So LeaseSites is a query? Include the PK as its own field in the query and use WHERE criteria in your combo's RowSource to select only the desired records. YOu can use the query name in the RowSource to make things simple.

    Here is a WHERE clause example

    "WHERE Company = " & Me.CompanyID.Value

    So maybe
    Me.Combo.Rowsource = "SELECT Company, LeaseCompany FROM LeaseSites WHERE Company = " & Me.CompanyID.Value

    Give your combo properties Column count = 2
    Column Width = 0, 2
    and bound column = 1

    Should get you started anyway



    This assumes you have a form with a control named CompanyID that is bound to your company table.

  5. #5
    breakingme10 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Oklahoma
    Posts
    153
    No lease sites is a table. the field is from an embedded lookup query.

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Consider storing PK values as foreign keys in other tables. You can use the query builder to help construct your SQL for your combobox. In the property sheet for your combobox click the eclipses (...) next to the rowsource to launch the query builder.

    You can add the where clause to the end of the string. Right click the rowsource property and use the zoom feature.

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

Similar Threads

  1. Replies: 3
    Last Post: 05-10-2013, 10:49 PM
  2. Replies: 1
    Last Post: 10-03-2012, 04:12 PM
  3. Combo Box - Field List Values
    By jennyaccord in forum Forms
    Replies: 5
    Last Post: 07-29-2011, 01:49 PM
  4. Replies: 2
    Last Post: 08-17-2010, 02:58 PM
  5. Replies: 1
    Last Post: 05-18-2010, 11:43 AM

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