Query By Combobox
Jul 27, 2007
Hi people.
I am creating a database for my dad's business. I am nearly finished but there is one more function that he needs from it and I have scoured the forums here and the web to try to find an answer to no avail.
Basically I want to design a query which returns a total VAT amount for jobs invoiced by quarter of a year. Looking at the forums etc I have found a way to query using the combobox where the values in the combobox are the table values, and I found a way of the query prompting for the start-finish dates, but the combobox that I want to use won't relate to any existing field headings (if that makes sense) ie option1 would be q1 (ie Jan, Feb & March) option2 would be q2 (April, May & June) etc. In my Invoices table, the VAT figure is already worked out for each invoice and is stored in a seperate field, so I don't need the query to work out the figure, but I just need help to set up the query/combobox so that it filters by 3 month's worth of dates as selected in the combobox.
Any help would be much appreciated. I got it to work whereby the query prompts for dates, but remembering the start/finish dates of the quarter seems a bit daft when these could be selected from the combobox.
PS I am quite new to this programming malarky so start from the beginning with any help :D
Thanks in advance
Nik
View Replies
ADVERTISEMENT
Apr 26, 2015
I am trying to use a combobox called Manufacturer to select which table the combobox called Model gets it's rowsource from using the code below.
Code:
Private Sub Manufacturer_AfterUpdate()
If (Me.Manufacturer.Value = "Siemens") Then
Me.Model.RowSourceType = "Table/Query"
Me.Model.Recordset = "SeimensTable"
Me.Model.RowSource = "SELECT Model FROM SeimensTable"
Else
If (Me.Manufacturer.Value = "Samsung") Then
Me.Model.RowSourceType = "Table/Query"
Me.Model.Recordset = "SamsungTable"
Me.Model.RowSource = "SELECT Model FROM SamsungTable"
End If
End If
End Sub
But when I run the form and select Manufacturer. Combobox Model remains empty. tell me what I'm doing wrong?
View 5 Replies
View Related
Jan 13, 2005
How would I modify multiple comboboxes in subforms at the same time. For example.. In main form ComboboxA user selects 1992, Combobox1 in subform1 is also changed to 1992, as well as Combobox2 in subform 2.
Whats the best way to do this?
View 2 Replies
View Related
Nov 24, 2005
I'm not entirely sure if this is possible, however I'm pretty sure I have seen it done in the past. But I've been racking my brains and scouring google for the solution with no luck what-so-ever.
What I'm trying to do is display a query, where one of the fields will have a drop down box that you can select from multiple values. I dont want to give away much information about the database structure (sensitive data, and all that fun stuff I'm sure most of you are familiar with). So I'm going to make up a hypothetical situation here.
Table: Person
Fields: pID, pFName, pLName, sID
Table: Status
Fields: sID, sDescription
Here is the basic query:
Select pID, pFName, pLName, sDescription
FROM Person, Status
WHERE Person.sID = Status.sID;
Then when the query is displayed, I'd like the status description to be capable of dropping down a list of the other possible selections. Now I know this wont work on a standard query. So what I did was create the query, then a form that displays in a query view. I have the one field as a combo box instead of a text box. However I'm just having trouble linking it up, it just shows what the current value is but not the other possible options.
If anyone could point me in the right direction, I would surely appreciate it.
Thanks
View 1 Replies
View Related
Feb 6, 2007
I have a form with a combobox called fraShipDay. How do I reference the value of the user's selection in a query? I've tried using Forms![Form1]![fraShipDay] but it's not working.
View 2 Replies
View Related
Dec 14, 2005
Hello everybody,
I am new to this forum. Currently, I am designing a database for the company I work at. It is the first time I use ACCESS and it is ACCESS 97 (!).
Now my first ( of probably many following ) questions :
I have a table with a key data field. Now I want to set up a combobox which lists all entries of a data field in that table ( but it's not the key field ). But, I do not want duplicate entries.
The SQL query for the combobox as created by the wizard looks like this :
SELECT DISTINCTROW NEW_ID.[Project ID], NEW_ID.[Work ID]
FROM NEW_ID;
I only want to display the "Work ID" entries, without duplicates. "Project ID" is the key. I already tried to change DISTINCTROW into DISTINCT but that does not work because every entry in "Project ID" is unique, only the "Work ID" entries can repeat.
If I omit "NEW_ID.[Project ID]" in the query, nothing is displayed...
So, what should I do?! Please help, many thanks in advance!!
Victor
View 5 Replies
View Related
Jan 6, 2013
I am new to access and was going through some tutorials. I am not able to run a query that takes value from a combobox and display the results based on that.
I used [Forms]![CustomerF]![StateCombo] under the criteria but its not generating the results..
I have also attached the db i am using ....
View 1 Replies
View Related
Apr 22, 2005
I have 2 comboboxes, the first one is called "activity", whereby I have 3 options to choose from, and the second is called "level".
When I click an "activity", for example Drawings, I want the "level" combobox to list a unique set of options for that category. and if I click on a different "activity" for example Planning, I want the "level" combobox to show a completely different set of options.
If anyone can give me any help on how to do this then I would be very grateful!!
Thanks
Angela :eek:
View 2 Replies
View Related
Jun 6, 2005
:( I have such problem : my query works right, but in ComboBox I got results with wrong sort.
Query results is:
Street 8
Street 8a
Street 10
Street 10/12
But in ComboBox data views such:
Street 10/12
Street 10
Street 8a
Street 8
Please help me!
View 2 Replies
View Related
Sep 19, 2007
Hi all,
I am hoping this is a simple dumb mistake I am making. I set up a two tables and an append query. The two tables are: first a table of employees and second a table of terms. I am using the last column in the table of employees to send a list to the terms table with an append query.
With that everything works fine. I even created a form of the table of employees so it could be edited on the form instead of the table. It still worked fine. The problem came in when I change the text box on the form that governed the term field to a combobox. I used "With me.combo...." in VBA to add a yes or no selection to the combo box.
When I try to run the append query then I am told their are lock violations and validation rule violations.
Any thoughts?
View 1 Replies
View Related
Mar 11, 2008
Hello,
I have a form containing a combobox with the values yes (1) and no (2).
In my query I have a date field. When the value of the combo is yes only the dates should be displayed. is the value no the the empty fields should be shown. I nothing is selected all fields should be displayed.
I tried this:
IIf(IsNull([Forms]![Form1]![cboDate]);
IIf([Forms]![Form1]![cboDate]=1;[tblITEM]![date_ID] is not null; is null);[tblITEM]![date_ID])
But without success.
View 1 Replies
View Related
Jun 21, 2005
I have this form where there's mention of CompanyID
In a subform, I have the information about all the contacts of this Company. In order to see full detail information for a particular contact (of that particular Company) I have a Combobox with a query.
At least: that's the whole idea. Unfortunately it doesn't work in Access:
SELECT Contact.ContactID, Contact.Name
FROM Contact
WHERE ((Contact.CompanyID)=(Me!frmCompany![ContactID]));
Can any help me? I need to do more of the sorts of queries... and I can't figure it out how to use values from forms and parent-forms.
Any help is appreciated,
Jazz
View 1 Replies
View Related
May 18, 2005
Hi all,
I have a combo box which gets it's values from a table. It also has a where statement to filter the data given the value in another combo box. I.e.
SELECT DISTINCT Table1.some_field FROM Table1 WHERE Table1.some_other_field = Forms!frmSomeForm.Combo_box
The first time I change the value in Combo_box combo box it will filter the values in my other combo box. But when I change it successive times it doesn't refresh the query, so the same values stay. Any suggestions?
View 8 Replies
View Related
Oct 16, 2014
I'm trying to filter the options in a combo box based on two criteria. The first criterion is another combo box on the same form, for a cascading combo effect. This criterion works fine, no problems at all. The second criterion is a query. So the combo box should display only those values that match both the upstream combobox AND the results of the query. What's really frustrating is that this combobox works just fine in my development dbase. It only stops working when I move it into my active dbase. Anyway, here's the SQL for the combobox rowsource:
SELECT DISTINCT Size2.SizeID, Size2.XYdim
FROM (Shapes INNER JOIN (qrySignsInInventory INNER JOIN Size2 ON qrySignsInInventory.SizeID = Size2.SizeID) ON Shapes.ShapeID = Size2.ShapeID) INNER JOIN Signs ON Shapes.ShapeID = Signs.ShapeID
WHERE (((Size2.SizeID)=[qrySignsInInventory].[SizeID]) AND ((Size2.ShapeID)=(SELECT Signs.ShapeID FROM Signs WHERE Signs.SignID = [Forms]![frmUsedDropdown]![cmbSignID])));
I've hilighted the criterion that isn't working. Also, I'm not getting any errors or anything, it's just that the results aren't being filtered. I've triple-checked the references for the active dbase, and I've checked the results of the query. Everything should be working.
View 4 Replies
View Related
Feb 27, 2014
I am trying to use a combobox to select a value which then activates a query to return results.
Here is some details
I have to tables, one called "Customers" and the other called "Calls". These two tables are linked.
The customers is literally a list of customers with their contact details, but all I am in interested in is the "Company" Field.
The Calls table has a field called "End User" which looks up the company from the Customers Table.
What I am trying to do is create a search by Customer query, furthermore, I would like to do is to create a form with a drop down that looks up from Customers table, select the company and it returns all the records with that company...
What I have done
I have created a query that has the customer and calls tables included, I have dragged down the [Company] from customer table and then all the fields from the Calls table.
Then i created a blank form, inserted a combobox - Combo7, linked the box to the Customers table.
Back to the query, under the [Company] I have put into the criteria the following
Forms!sc!Combo7
Back to the form, selected the combo box, built a macro in the AfterUpdate, to run the query.
Tested this and it does not bring anything back, however if I put into the criteria Like [Please Enter Company Name], then typed the company name, it brings back all the records for that customer.
Am I missing something?, do I need to set the form control to the query, or even the combobox....
View 1 Replies
View Related
May 11, 2015
I created a form that has about 8 different filter options that can be used to filter a query. I used the filter by form table to set it all up and I can get each of them to work individually as well as 2 work together... but as soon as I added the information for the 3rd, I stopped getting results... in fact nothing happens. Even with the code for all 3 and selecting just 1 option, nothing happens any more. I have
cbopersonnel that is supposed to look up values in 4 different personnel columns
cboshift that looks up all shift work
cboworkdef that looks up what the job was (just a title)
Having just 2 in the filter by form works great, but adding 3 screws everything up. And I'm not talking about selecting all three (I know that would limit the output more) but I mean, with all 3 setup and selecting shift as "nights"... nothing gets filtered anymore. I have cbopersonnel on "look for" tab and everything else is on the next "or" tab. I tried to set it up on individual tabs but access combined it. I also tried adding cboshift to the "or" tab with everything else and access sent it back to "look for". All of the cbo references are under their respective search area... so in the table, the shift column has the cboshift lookup value. Is it just because I'm not using quotes around the cbo output? That doesn't make sense to me though. Anyway below is the lookup value for the cboshift.
[Forms]![Log Book Lookup]![cboshift]
View 2 Replies
View Related
Mar 15, 2005
All:
Currently have a Form / SubForm arrangement combining qryItemAllowedAndUnschedlued with tblInventoryItem.
The main form is based on the query and the subform on the table.
My effort is to create cascading combo boxes where a selection in the main form populates a "conditional" list in the subform.
More specifically, where the user selects ItemClass in the main form, I am attempting to populate a list of ItemCategories in the subform based on the selected ItemClass.
I have reviewed and continue to study existing posts on Cascading Combo Boxes and Form / Subform arrangements. However I currently have a question I do not see covered...
When I select my ItemClass it is populating throughout the query and not solely in the current record displayed.
Does anyone know why this may be?
I fear the answer is a simple setting that my current experience is making difficult to isolate. I trust it will present itself with patience, but in the interim more experienced feedback is welcome!
Regards
View 1 Replies
View Related
Sep 10, 2005
Hi all,
I have a combobox on a form which retreives its data using an SQL statement (I used the query builder). In one of the columns shown in this combobox I filter the data by refering to a another combox on the same form.
the syntax is: >=forms!frmCursusGegevens!DatumCursusID.column(1)
Running the form and accessing the combobox issues error 3085, stating that a function is used that is unknown.
Removing the '.column(1)' part solves the problem, but ofcourse this is not what I want. It confirms though that the problem is with this .colomn(1) reference.
I'm sure the syntax is correct, because in a modules' direct window I'm capable to retreive the data by typing:
?forms!frmCursusGegevens!DatumCursusID.column(1)
I've used the same procedure in many MS access projects using older versions of Access. In the current version 2003 it gives this problem...
Who can assist me here?
Thanks and regards!
Olaf
View 4 Replies
View Related
Apr 16, 2014
I have a small form with a combobox that gets its data from a query.
I added code to this database to forward to me info about forms and controls in case they generate errors. Occasionally I get an "error = 0" on this combobox.
Since there are no events attached to this combobox then what could be causing this error?
View 8 Replies
View Related
Jul 24, 2014
I have been spending all my today to fill a combobox dynamically, but have not been able yet.
I have a combobox and a pass-through query in access, which is working fine and fill the details into the combobox via data source. Now what I am planning to do is to update the combobox source as soon as value in a text box changes.
Here is the code I am using, but it is not working:
Dim rs As Recordset
Dim qDef As QueryDef
Set qDef = CurrentDb.QueryDefs("get_data")
qDef.SQL = "SELECT Initial + ' (' + Name + ')' uws FROM EM.dbo.UW" _
& " WHERE lob = '" & addSingleQuotation(Me.CMB_LOB.Value) & "'"
Me.cmbUM.RowSource = qDef.SQL
Me.cmbUM.Requery
I also used Recordset, but did not work:
Set rs = CurrentDb.OpenRecordset("get_data")
Me.cmbUM.RowSource = rs!uws
View 1 Replies
View Related
Oct 14, 2014
I have a combobox that I use to combine the employees first name and id number. So when you pull down the list you can select the employee you want and it is saved in the form. Now I need to create a query so that I can create a report on each employee separately. The query will not let me get the Employee Frist Name/ID from that saved field. I thought that what is saves in that field, you can retrieve it in your queries or reports.
View 3 Replies
View Related
Jan 25, 2006
I've tried searching the forums and haven't found quite what i'm looking for. I would like to be able to change the source for a combobox based on another combobox. The simplest way i can summarize that is i want to be able to choose A or B, depending on my choice i want another combobox to display all the values that A or B can have.
Thanks
Jim
I'm not sure I worded that very well. :(
View 1 Replies
View Related
Feb 25, 2008
Hey all,
I've read some tutorials on this sort of thing, but I can't seem to piece it all together to achieve what I want.
I have a table Products that contains the fields Product, Size and Brand. I also have a form, frmProducts, that has a combobox linked to each of the fields in the Products table. I want to be able to select a product from the first combobox, tab to the Brand combobox and have only those brands associated with the product already selected.
This is how I think it should work:
1.ComboBox1 selects productA
2.ComboBox2 takes its options from a query that searches Products table for all instances of productA and displays all available brands. brandA is selected.
3.ComboBox3 get its options from another query that searches for all instances of productA that also have brandA and displays all available sizes.
What I'm having trouble with in particular is passing the data between queries. For example, I can't figure out how to tell the query to search for all instances of productA when its defined by the first combobox. Do I have to store it as a variable somewhere?
I hope I've been clear.
View 6 Replies
View Related
Aug 2, 2005
Hi,
I currently have a form that creates a report based on a query that takes in a start date and an end date.
What I would like to do is to create comboboxes that will let the user choose a month and year for the report.
Is there a simple way to choose an entire month in access? I've tried using the Month() function to no avail.
The SQL statement for where I select the start and end date is below:
WHERE ((([tblData].[EntryDate])
Between [Forms]![frmByRange]![BeginningDate] And [Forms]![frmByRange]![EndingDate])
Any help would be much appreciated!
View 2 Replies
View Related
Dec 12, 2006
Folks,
can someone help me on this? I am not sure why the select query inside this procedure is not working. Here is the that routine:
Public Sub temp()
Dim strDocName As String
Dim strTableName As String
Dim strTbl As String
Dim aot As Access.AccessObject
Dim strSQL As String
Dim rpt As Report
Set rpt = CreateReport
strTbl = Forms!frmSearchBoilerGuar!cboTypeOfGuar
For Each aot In CurrentData.AllTables
If aot.Name = "strTbl" Then
strTableName = strTbl
End If
Next aot
strSQL = "SELECT tblProjts1.chrProjectName, tblProjts1.chrBlrPropNum, " & _
"strTablename.memGuranItem , strTableName.memLDs FROM tblProjts1 " & _
"FROM tblProjts1 LEFT JOIN strTableName ON" & _
"tblProjts1.intProjectId = strTableName.intProjectId"
rpt.RecordSource = strSQL
strDocName = "rpt"
DoCmd.OpenReport strDocName, acPreview
End Sub
Basically, I am trying to select a table name from the combobox and then use that table name for my query. Then I want to use that query as a recordsource for my report.
Any help is greatly apprecited.
Shan.
View 2 Replies
View Related
Jun 8, 2007
Hi, I have been reading through the forum and found alot of really interesting stuff but cannot seem to find the answer to my specific problem. I'm sure it's easy but i'm sick of trying to figure it out now.
I am trying to build a form to display a shift rota. My tables contain daily shift patterns for 6 staff members for 2007. I want to build a form that has a subform displaying the rota for a particular analyst and a control in the master form to select which of the 6 staff members you wish to view. I have built a master form with a combo box. The combo box holds the names of the six staff and gets this data with a select statement in the Control Source field from the employee table. I constructed this with the wizard. I have constructed a query to drive the sub form. The query builds the rota, getting data from my tables but gives all shifts for all dates for all staff . I want to restict this in my subform to all shifts for all dates but for 1 member of staff. The member of staff should be defined by the selection made in the combo box in the master form. I then have a statement in the criteria of the query driving the subform to restrict the results by name to the name selected in the master form combo box. I'm sure this should work as i have used similar methods in the past. The statement in the query criteria reads like this:
[forms]![frmRota].[cmbAnalystSelect]
this is in the field of analystName, so the criteria should find all instances where the value in the analystName field matches the value in the cmbAnalystSelect control. However, the query always returns no results.
When i run the quey i have already opened the form (frmRota) and selected a value for cmbAnalystSelect, so the quey should collect the value from the combo box and filter the result according to the criteria but it seems to filter out all the results. If i run the query without first opening the frmRota form then i am prompted by a dialog box to enter a value for [forms]![frmRota].[cmbAnalystSelect]. If i enter a corresponding correct value (a valid name for a member of staff) the query returns a correct set of results, i.e. all shift patterns for all dates for the selected member of staff. When i have the form already opened i am not prompted for a value by the dialog box which would suggest it is at least recognising the form is open and that the control is there.
The last thing is that my ComboBox control is not bound to anything, when i view the control in design view it says it is unbound. I have nothing in the control source for the ComboBox. In the row source i have a select statement to pick out the employee names from the employee table, this then poulates the list in the ComboBox.
I hope this is enough info for someone to understand my problem and offer some advice, i can elaborate, attach screen shots etc. if needed.
Thanks in advance for any advice you can offer.
View 4 Replies
View Related