Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

Query based on dropdown selection

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AnotherNewGuy - 21 May 2008 17:34 GMT
Access 2003

I have very simple form with one ComboBox to select software titles.  I just
want to see every computer with a specific piece of software installed.  If
someone could explain why queries run from the form return nothing, I'd sure
appreciate it.

Query is "Software Search"
Form is "Software Search"
Combox box is "SoftwareList"

Criteria of the query is "Like [forms]![software search]![softwarelist]"

I can select from the list and run the query from a command button and get
nothing, but I can run the query outside the form and type in a name, and it
works fine.

The following is the code for the On Click event of the button:
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click

   Dim stDocName As String

   stDocName = "Software search"
   DoCmd.OpenQuery stDocName, acNormal, acReadOnly

Exit_Command2_Click:
   Exit Sub

Err_Command2_Click:
   MsgBox Err.Description
   Resume Exit_Command2_Click
   
End Sub
KARL DEWEY - 21 May 2008 21:50 GMT
Open the query in design view and scroll to the right to a blank column.
Paste the following in the Field row of the grid --
 Just Checking: [forms]![software search]![softwarelist]
Remove the criteria.  Do not save.
Use the ComboBox to select a software title.  Run the query and see what
appears in the "Just Checking" field.   Is it what is required as criteria?

Signature

KARL DEWEY
Build a little - Test a little

> Access 2003
>
[quoted text clipped - 30 lines]
>    
> End Sub
AnotherNewGuy - 21 May 2008 22:22 GMT
Well, no, it's not.  That little experiment told me exactly what I was doing
wrong; I was convinced it wasn't passing the parameter to the query.  You
probably already knew it was pulling the wrong field from the Software Titles
table.  A quick change to the Bound Column solved the problem.

Instead of just answering the question, you told me how to figure it out
myself.  Thanks loads.

> Open the query in design view and scroll to the right to a blank column.
> Paste the following in the Field row of the grid --
[quoted text clipped - 37 lines]
> >    
> > End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.