Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I don't see anything offhand, presuming both fields are text. The way to debug it is to add this line:

    Debug.Print strSource2

    right before setting the rowsource. That will print the finished SQL to the VBA Immediate window. If you don't spot the problem there, copy/paste the SQL into a new query in SQL view and try to run it. If that still doesn't reveal the problem, can you post the db?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  2. #17
    JennyHunt is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    11

    database

    I had to strip some info, but here is the database.
    Any help is greatly appreciated.

  3. #18
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    I'm guessing the pbaldster should be able to help you, but if you don't mind another pair of eyes, can you upload it as an Access 2000 .MDB file?

    If you're willing to do that, I can give it a look too and see if I can help.

  4. #19
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Should have noticed this. In this code you've reset the Unit combo, but then try to use it's value, so the SQL is

    ...WHERE Unit = '' AND PropertyCode = 'BBP'...

    which obviously won't return anything.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #20
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Ooo, good point.

    Try the following and see if it works

    Code:
    Private Sub cboPropCode_AfterUpdate()
      Dim strSource As String
      Dim strSource2 As String
    
      strSource = "SELECT DISTINCT Unit " & _
                  "FROM qry_Contacts " & _
                  "WHERE PropertyCode = '" & Me.cboPropCode & "' ORDER BY Unit"
    
      strSource2 = "SELECT DISTINCT Tenant " & _
                   "FROM qry_Contacts " & _
                   "WHERE Unit = '" & Me.cboUnit & "' AND PropertyCode = '" & Me.cboPropCode & "' ORDER BY Tenant"
    
      Me.cboUnit.RowSource = strSource
      Me.cboUnit = vbNullString
    
      Me.cboTenant.RowSource = strSource2
      Me.cboTenant = vbNullString
    End Sub

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. WHERE clause "too complex"
    By Ted C in forum Queries
    Replies: 4
    Last Post: 06-30-2010, 12:08 PM
  2. Replies: 1
    Last Post: 05-13-2010, 10:50 AM
  3. Creating "Edit Record" link in table column
    By joshearl in forum Forms
    Replies: 1
    Last Post: 12-25-2009, 11:17 AM
  4. Replies: 21
    Last Post: 06-03-2009, 05:54 PM
  5. "Count" and "Countif" in Reports
    By JMantei in forum Reports
    Replies: 1
    Last Post: 06-20-2006, 02:20 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