Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Selection Criteria
Robert Stott 
    
3 years ago
I have always built my selection criteria code based on 2 or more combo box or check box selections. I always use a query as source and add the tables ID or 0,-1 respectively.

This time I want to use 3rd combo boxes, one of which a field in the main table(so I cant use and ID), and I am trying figure how to use the selected value(which is Text) in the 3 combo box. My code gets a parameter Box asking for a value.

I am just mentally unable to handle this. I researched the best I could and am coming up blank.

The code will follow, but this is for a personal Database for me to track all videos' and training I watch on this web site, which was becoming difficult to remember when I wanted relook at something. Here is the Code (which I developed in 1995):

DetailsPrivate Sub EditRecordBtn_Click()
On Error GoTo Err_EditRecordBtn_Click
    Dim xAnd As String
    Dim SelCrit As String
    Dim stDocName As String
    Dim stLinkCriteria As String
    
    stDocName1 = "TechHelpFrm"
  
    'Selection Criteria
    'Intialization
    xAnd = ""
    SelCrit = ""
    
    'This Section Processes Audio Items for a specific Subject
    If IsNull(Me![cboSubject]) = False Then
        SelCrit = SelCrit & xAnd & "[SubjectAreaID] =" & Me![cboSubject]
        xAnd = " And "
    End If
    'This Section Processes Audio Items for Specific Level
    If IsNull(Me![cboLevel]) = False Then
        SelCrit = SelCrit & xAnd & "[TrainingLevelID] =" & Me![cboLevel]
        xAnd = " And "
    End If
    'This Section Processes Audio Items for Specific TechHelp
    If IsNull(Me![cboTechHelp]) = False Then
    SelCrit = SelCrit & xAnd & "[HelpTechName] =" & Me![cboTechHelp]
    xAnd = " And "
    End If

    DoCmd.OpenForm stDocName1, , , SelCrit
Exit_EditRecordBtn_Click:
    Exit Sub
Err_EditRecordBtn_Click:
    MsgBox Err.Description
    Resume Exit_EditRecordBtn_Click

End Sub


It's the TechHelp section that's not working. Any input would apricated.
Kevin Robertson  @Reply  
          
3 years ago
TechHelpName would be a String value. Correct?
You need to use Double Double Quotes

SelCrit = SelCrit & xAnd & "HelpTechName =""" & cboTechHelp & """"

If the ID is the first column, you will need to access the Column property of the Combo Box (ComboBoxName.Column(1)).
Robert Stott OP  @Reply  
    
3 years ago
I see where your going but I think I am have a double Quote problem. Get the same Parameter Box asking for TechHelpName
Robert Stott OP  @Reply  
    
3 years ago
One More thing:

SelCrit = SelCrit & xAnd & "HelpTechName =""" & cboTechHelp.Column(1) & """"

The Column 1 is the ID of the table the query in the combo box is based on. Now the form opens' after asking for "HelpTechName" which it didn't before.
Scott Axton  @Reply  
        
3 years ago
Check your spelling.  Is it TechHelp or HelpTech?
Robert Stott OP  @Reply  
    
3 years ago
I did name it wrong, but it correct spelling for the cob box the the field name that i gave it. That was my first thought when i got Message box.
Alex Hedley  @Reply  
           
3 years ago
Can you MsgBox, Debug.Print or Status SelCrit to see what the final value is?
Robert Stott OP  @Reply  
    
3 years ago
I did do the MsgBox debug and I did have s a spelling error - I have to apologize I just didn't see it before. Everything is working great and learned some lessons of Debugging.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/30/2026 3:23:02 PM. PLT: 1s