Page 3 of 3 FirstFirst 123
Results 31 to 34 of 34
  1. #31
    mdewell is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    38

    Code:
    [Form_sbfHIPAAdatasheet].RecordSource = SubFormSQL & WhereStatementSQL
     
      Set rs = db.OpenRecordset(SubFormSQL & WhereStatementSQL)
      If rs.RecordCount = 0 Then
           ' Don't add ending ")"

  2. #32
    mdewell is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    38
    OK, there's a little bit of missing code becauuse for some reason it won't let me post it here. But anyway, the last section of code is creating the SQL statement to update the ComputerLookUp combo box.

    Anyhow, June7, your code looks a lot more clean, and perhaps more efficient, but is it possible to add all the filters I have into the SQL statement and get it to work. I also have some more I need to add to the filtering process, so I guess I need to get a good understanding of the SQL statement you are making with :

    SELECT Computer.Computer
    FROM (HIPAA_relational LEFT JOIN OU ON HIPAA_relational.OU_ID = OU.ID) LEFT JOIN Computer ON HIPAA_relational.Computer_ID = Computer.ID
    WHERE (((IIf([Forms]![HIPAA_datasheet]![OUFilter]="<All>",[OU_ID] Like "*",[OU_ID]=[Forms]![HIPAA_datasheet]![OUFilter]))<>False));

    I'll post my current version so you can perhaps see what I'm up to, and maybe give me some help with my new issue of getting an unbound textbox to update a table.

  3. #33
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    You certainly have expanded the Set OUFilter function.

    Well, yes, I suppose you can have as many criteria in that SQL as you want. However, I don't understand the <>False. That was not in my version.

    What is it you do not understand about the query?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #34
    mdewell is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    38
    I guess I need to look at how your SQL statement is made. I'm a little more concerned with my other topic I started concerning the 'Textbox record source for datasheet subform view'. So if you could reply to that one, as you started, and we can perhaps close this thread.

    Also, just for clarification, I know I don't have that many records, but should I have more records, is my building the SQL statement a slower process than just writing out the SQL staement that does all the processing with in the statement. I.E., your statment is the somewhat simple:

    Code:
    SELECT Computer.Computer
    FROM (HIPAA_relational LEFT JOIN OU ON HIPAA_relational.OU_ID = OU.ID) LEFT JOIN Computer ON HIPAA_relational.Computer_ID = Computer.ID
    WHERE (((IIf([Forms]![HIPAA_datasheet]![OUFilter]="<All>",[OU_ID] Like "*",[OU_ID]=[Forms]![HIPAA_datasheet]![OUFilter]))<>False));
    Where as mine isn't that advanced, and just uses a WHERE and AND, without a LEFT JOIN.

    Actually, looking at your statement, I guess I need to do some research into the IIF statement. I'm just curious how much faster your statement is, compared to the one I build?

    Thanks

Page 3 of 3 FirstFirst 123
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 07-20-2015, 10:55 AM
  2. Replies: 4
    Last Post: 01-24-2011, 07:11 PM
  3. Replies: 2
    Last Post: 12-07-2010, 12:32 PM
  4. Replies: 3
    Last Post: 12-06-2010, 06:35 PM
  5. Replies: 1
    Last Post: 08-26-2009, 10:45 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