Query W/selection

Mar 30, 2008

I've got a query; works great as written; but I need to be able to have users choose which month to pull data for.
Right now; I pull the current month data using:

Between DateSerial(Year(Date()),Month(Date()),1) And DateSerial(Year(Date()),Month(Date())+1,0)

Is there a way I can rewrite this but use a user-selectable date for the month? I'm thinking it could be done w/two queries; but not sure about just one....

Thx

View Replies


ADVERTISEMENT

Forms :: Nomination Form - Combobox Selection List Not Updating After Each Selection

Oct 27, 2014

I am designing a nomination form (web database so no vba macros can be used).

The form has 3 combo boxes: cboStaffName, cboLevel, cboNominee.

The form is bound to the tblSubmit table where the submissions are populated.

I used a select statement:SELECT Staff_List.Staff_Name FROM Staff_List; to populate the combo box for the Staff Name selection.

This is the select statement to populate the job level combobox:

SELECT Staff_List.Level, Staff_List.Staff_Name FROM Staff_List WHERE (((Staff_List.Staff_Name)=[forms]![frmtest]![cboStaffName]));

The select statement to populate the combobox for the nominee combobox:

SELECT Staff_List.Staff_Name FROM Staff_List WHERE (((Staff_List.Level)=[forms]![frmtest]![cboLevel]));

The problem is that the staff_name in the first combobox is still found in the nominee combobox which should not be because a staff cannot nominate self. There is a field in the Staff_List called YesNo that should be activated for each staff that is selected so that the select statement on the nominee combobox can be updated accordingly to remove items with the field "Active"

How to get the checkbox selected for each corresponding staff.

Sample of the database has been attached.

View 4 Replies View Related

Optional Selection In Query

May 12, 2006

I have two drop-downs on a form along with a child form that shows data based on a query. If both drop downs have selections, say date and dept. then the query would change and the child would show the data - that works fine, but what if one of the drop downs didn't have a value selected, as in i select a date but just want all departments so select noting from the second dd - how would i write the query to reflect this optional selection?

View 6 Replies View Related

Selection Query To Form

Jun 7, 2006

I wonder if anyone can help with this:

I have put a selection query as a subform in a form which shows client details. When the form opens from the switchboard it asks the user to enter the clients unique number and then the query links the number to the client ID (autonumber) which then populates the form with all the details for that client. This is all great but I have 2 questions?

1. If I put in an incorrect number or press cancel the form loads anyway with no record. Is there a way to force the user to re-enter the number or if the number does not exist say so, and then return to the switchboard. The aim of this form is for reference and not data entry anyway.

2. Once in the form correctly is there a way to 'refresh' the form so that it asks for the card number again. My plan is to have a button "search for another client" and when it is pressed the query runs again and the input box comes up.

Cheers

View 1 Replies View Related

Combo Box Selection For Query

Feb 13, 2006

I'm new at Access 03. I have a combobox that is sourced by a table, Rowsource property is:

SELECT Classes.TableID, Classes.ClassID FROM Classes;

The name of my combobox is "ClassCombo".

I'm trying to generate a report based on my combobox selection, but I can't reference the value of the selection. The query tied to my report has the following SQL:

SELECT ClassesForInstructors.ClassID, Instructors.InstructorID, Instructors.FirstName, Instructors.LastName
FROM Instructors INNER JOIN ClassesForInstructors ON Instructors.InstructorID = ClassesForInstructors.InstructorID
WHERE (((ClassesForInstructors.ClassID)="[Forms]![School]![ClassCombo]"));

I'm trying to grab the "ClassCombo" value as input to my query, but it's not working. What am I doing wrong?

Thanks!

View 2 Replies View Related

Query Job Id Selection Vis Text Box Input

Jun 29, 2006

I am trying to produce a query that will search for multiple records by job id entered into a text box eg 17656,18768,15679.

The example i have found uses the (LIKE '*value*') so if i type in part of a job id (176) it will display all records starting with 176. I would like to enter specific job id numbers seperated by a , and only display these

Would be grateful for any help

View 2 Replies View Related

Multiple Selection In A Query From A Form

Aug 1, 2006

Dear All

I've got an issue with a query/form combination that I'm working on. I have the following:

A query where one of the the fields is 'Name' (a text field). 'Name' can be one of 6 different values. I have a form which has 6 check boxes, one for each name. I'm using check boxes on the form rather than a multiple selection list box simply because I think it looks better.

When the user has checked one or more of the check boxes and hits the 'show results' button, I want the query to open up with the details for orders associated with the name(s) selected.

I am writing my query in 'design view' rather than in 'SQL view', and don't know what to put in the criteria box of the 'Name' field. Depending on which check boxes are checked, I'm building a string and storing it in a text box, called Text1. I think the best way to do the filter is to use the In operator, and I currently have a structure like this in the criteria of the query: In([Forms]![Form1]![Text1]). This, however, doesn't give any results.

The problem I have, therefore, is that I don't know the correct syntax for the text within Text1. If I have, for example "Rob","Dave" as the text in Text1, it doesn't work, but if I put In("Rob","Dave") in the criteria rather than referencing the text box, it works fine.

Do anyone know what I'm doing wrong?

View 1 Replies View Related

Query By Multiple Selection List Box

Jul 24, 2007

so i have two listboxes that have the values i want for the query parameters. I slightly modified one code i found so that i can query using one of them, however i cannot figure out how to get the second listbox to put criteria into another field. The working code i'm using is:

Private Sub Command_Click()
On Error GoTo Err_Command_Click

On Error GoTo Err_Handler
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String


For Each varItem In Me.PartyBox.ItemsSelected
strCriteria = strCriteria & "counterparties.counterparty =" & Chr(34) & Me.PartyBox.ItemData(varItem) & Chr(34) & " Or "
Next varItem


strCriteria = Left(strCriteria, Len(strCriteria) - 4)

strSQL = "SELECT counterparties.[Counterparty Entity], Fund.[Fund Name], products.Product, combine.[Available?] " & _
"FROM products INNER JOIN (Fund INNER JOIN (counterparties INNER JOIN combine ON counterparties.[Counterparty ID] = combine.[company id]) ON Fund.[Fund ID] = combine.[fund id]) ON products.[Product ID] = combine.[product id] " & _
"WHERE " & strCriteria


CurrentDb.QueryDefs("1").SQL = strSQL


DoCmd.OpenQuery "1"

Exit_Handler:
Exit Sub

Err_Handler:
If Err.Number = 5 Then
MsgBox "Must Make A Selection First", , "Make A Selection First"
Exit Sub
Else
MsgBox Err.Number & " " & Err.Description
Resume Exit_Handler
End If


Dim stDocName As String
stDocName = "combqry"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command_Click:
Exit Sub

Err_Command_Click:
MsgBox Err.Description
Resume Exit_Command_Click

End Sub



I am trying to be able to search by Product and counterparty.
Any help is greatly appreciated, thanks!

View 8 Replies View Related

Running A Query By A Selection From A Combo Box

Dec 10, 2007

I have a query that runs info selected from safety visits. I have made a form with an unbound combobox that selects the supervisors name and after the name is selected, I have a button to run the query. When a name is selected, the query comes up blank. When I do not select the name, the query is populated.

My criteria on the query is [forms]![personnel]![combo9]

Combo9 is the unbound dropdown menu with the supervisors name that is taken from a table of names.

Any help?

Thanks in advance.:(

View 1 Replies View Related

Using A Combo Box Selection For Query Criteria

Nov 1, 2006

I have a report that is based on a query. In the query, I have a field called "Mode". In the criteria section for the Mode field, I am calling the selection from a combo box on a form called "frm_main". So the criteria for the Mode field is "[Forms]![frm_Main]![Mode_ComboBox]". This combo box has selections for 1,2,3,4,5. I want a selecton on the combo box that will work with the query to show all modes. Sometimes something weird gets entered into the database like "NoMode" for example. I have tried adding a combo box selection of "*" , "Is Not Null" and "". If I manually type these into the criteria section of the query, it works fine. But when I use these in the combo box and call the combo box selection from the query, it does not work.

Does anyone have any idea what I can use in my combo box selection that when selected, the query (and hense report) will show all data?

Thanks,
Jim

View 5 Replies View Related

Using A Combo Box Selection To Populate A Query

Nov 26, 2004

I have 2 questions which are linked. I am trying to run a query based on a selection from a combo box. Would someone be so kind to indicte if i need to use VB or can i do it directly from Access?

I have made the query and the combo box table but i am unable to get the combo box selection to be used in the query.

Additionally i want the query to look at a date range. In the query criteria i use "=now()" but i want the combo box selection to populate the rest of the criteria so it look like =now()+ XXX where XXX = a number of days, eg 14 or 30.

Any help would be gratefully received.

View 2 Replies View Related

Multitable Field Selection Query

Apr 21, 2007

Hi Gurus,

I have a database newbie question. I am writing appli. in asp. i have 2 table 1 MsgMst and 2 UserMst UserMst has fields ID and UserName and MsgMst has fields ID, UserID (which is ID from UserMst), MsgDate and Msg. I want to list UserName, MsgDate and Msg in 3 columns of table. Can I get all three (USername from UserMst parallel to UserID in MsgMst Table) and MsgDate and Msg fields from MsgMst table in a single Recordset? What should be SQL Query?

Thank you in advance!

View 3 Replies View Related

One ComboBox Selection Filtering Selection Of Second.

Jan 12, 2005

Porbably a stupid queston for most of you, but I am new to the game. Trying to get the selection of one combo box to filter the selections of a second combo box. Have one table called Sections with the colums SectionID and SectionName, a Second Table called SubSection with Colums SubSectionID, SubSectionName, and SectionID. Third Table called Points which has a column for Section, and SubSection, need to have the section combobox selection filter the SubSection combobox selections. Any help would be appreciated!

View 1 Replies View Related

Query Selection - Multiple Choices, One Field

May 19, 2005

I have a database which keeps track of a trucking business. Each truck has a trailer number. I have no problem having a query prompt the user to enter a single trailer number to query on. What can I do when the customer needs to select more than one trailer number to query on?

View 4 Replies View Related

Query Based On Current Record Selection

Jan 8, 2006

right, struggling here.
Basically I have continuous form listing all the standard letters sent out when I double click on a letter, I need to to run a query for me. The code I have put behind the button is:
If ([StandardLetterType] = "Homework") Then
DoCmd.OpenQuery ("qryHomeworkClearMailMerge")
DoCmd.OpenQuery ("MergeHomework"), , , , , acDialog, Me.[StandardLetterID]
DoCmd.OpenReport ("rptHomework"), acViewPreview
Else
'
end if

and in the query I am first clearing the mailmerge yes/no field out which works fine and then running the merge to put the yes back in the current record so the query looks like this

Its an update query with update to yes for mailmerge and under the standard letter ID i have the criteria [Me].[OpenArgs]

is this completely wrong tried the [Forms!][frmFullStudentReport].[standardletterID] but it kept popping the box up asking for the number.

On the form I have the standardletterID and its hidden but there.

Any help would be greatly appreciated

View 1 Replies View Related

Displaying Selection-query In Form Display

Jul 27, 2005

Hello there,

perhaps it could be a fault in my PC;
though I designed a form which depends on a selection-query and when I fill in the criteria in the selction query to look for a certain record, my form display stays empty. Even empty records won't be shown.
Is this phenomenon occuring either normal in Access or is this problem related to the configurations of whether my query or relations.

It's already pissing me off the whole day,

so I would be very eager to know what's the solution,

grtz

View 1 Replies View Related

Question Regarding Returning Query Selection From A Form

Jan 11, 2006

I have a table called Prem. It contains three fields (Offer, MailCode, MktgProgam). I want to have a form where a user can select. the Offer (from the offer field) Once selected, it takes the MailCode and MktgProgam information from the Prem table and uses that info (MailCode, MktgProgram) to pull from the main table called "Cust" Is this doable?

Thanks in advance

View 4 Replies View Related

Run A Query/report Based On Selection From List

Feb 10, 2006

Dear all, is it possible to run a query (or ideally a report) based on a selection from a drop down list in a form? (in accsess 97). The reson being is i have a big list of of codes for different absence reasons & at present the user has to type in the correct code to display the data in a report based on the code they enter, however its not easy for users to remember which code to type in to run a report.

Idealy what i would like is a drop down list with the absence codes & the absence desciption next to each code, then when the user selects a code from the list it displays the corresponding data in the report?

Is this possible?, any help would be much appreciated, thanks.

View 4 Replies View Related

Refreshing A Query Based On A Combo Box Selection

Dec 1, 2004

I have a form on which i make a selection. This selection then populates a query which in turn generates a report. The problem that i have is that when i go back into my form and make another selection the query, and therefore the report, holds the original data.

My question is how can i refresh the selection and therefore produce different reports based on this selection without exiting the application?

Many thanks for any help provided in advance.

View 4 Replies View Related

Use Selection From Drop Down List As Parameter For Another Query.

Feb 4, 2005

I want to be able to choose an item from a drop down list (based on a query i.e. distinct products) and have the item chosen to be automatically used as a parameter in another query.

Thank you

View 7 Replies View Related

Forms :: Saving Selection From Listboxes To A Query

Aug 20, 2014

I am new to Access and I have get to where the users can make selections in the listboxes, but then I need to save the selection in a query or table to save thier changes.

View 1 Replies View Related

Queries :: Using A Form Selection As A Query Field

Oct 24, 2013

I've inherited a database that has a table with a large number of Yes/No fields. Apart from normalizing the database, I was wondering if the following was possible:

ContractTable has Yes/No Fields for rights granted for each order (television, dvd, internet etc).

Using a form, the user selects the specific right they'd like to run a report on - selecting this right from a drop-down menu, this is labelled "RightsCombo21" on the form.

When the button is clicked, the right selected is now the "Field" section of the query.

The SQL query right now looks like this (shows all rights sold for the territory):

WHERE ((([Contract Table].[Contract Cancelled])=False) AND (([Contract Table].[Contract End Date])>Now()) AND (([Contract Table].[Contract Type])="License Agreement") AND ((ContractIDAndCountry.CountryName)=[Forms]![TerritorySpecificRightsChooser]![TerritoryCombo7]));

I'd like to add something to this WHERE statement:

AND (([Contract Table].RightsCombo21)=True)

Not sure if it's a syntax issue, or I'm attempting something that isn't possible.

View 4 Replies View Related

Forms :: Combo Box Selection With Multiple Query

Feb 18, 2015

I have created form with multiple tables field in some of these fields I have assigned the combo box selection the total combo boxes in form is four and all are unique numbers but this form is incomplete.

1.When I select or update any of four combo box then remaining combo boxes and fields on form should be updated automatically with related records.

2.I need to bring calculated fields from multiple queries on to my current form .how I can insert query fields in to form...

View 1 Replies View Related

Modules & VBA :: Combo Box Query Field Selection

Jul 31, 2014

I'm trying to write a query to allow the user to search through records.

To make the interface simple I just want a combobox to select the search field and a text box to enter the search string.

My problem is trying to build a query where the value of a combobox on a form is used as a field in the query.

View 3 Replies View Related

Queries :: Add Date Selection Criteria To Query?

Sep 11, 2014

Below is the SQL for a query I have, which returns events that are scheduled for today, I need to change this so that The user can specify events to be displayed in a date range and If possible only show those events for the users windows ID

Code:

SELECT tblEvent.EventStart, tblEvent.EventOwner, qryCompany.Company, ltDescriptionType.Description
FROM (tblEvent INNER JOIN qryCompany ON tblEvent.Company = qryCompany.ContactID) INNER JOIN ltDescriptionType ON tblEvent.EventDescrip = ltDescriptionType.[DescriptionType ID]
WHERE (((tblEvent.EventStart)=Date()))
ORDER BY tblEvent.EventStart, tblEvent.EventOwner;

View 2 Replies View Related

Queries :: Can Run A Query Based On A List Box Selection

Jul 31, 2013

I have a query that allows the user to put in a date range - this works.He also wants to limit what he prints.

For example at the moment he gets

OrderA rest of line 1 for orderA
OrderA rest of line 2 for orderA
OrderA rest of line 3 for orderA
OrderB rest of line 1 for orderB
OrderC rest of line 1 for orderC
OrderC rest of line 2 for orderC
OrderD rest of line 1 for orderD
.
.
.OrderZ etc

He only wants to say print lines for OrderA and OrderD. It's he's choice and not based on anything else already in the table.

I see that in the criteria on the design for the query it allows me to bbuild an expression and I can select a list box on the form such as

[Forms]![name of form where list box is]![name of list box].[EXPRESSION VALUES]

I don't know which expression value to choose. I have tried afterupdate and beforeupdate but none of the rest look like they are the ones I should be using.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved