Form To Select Fields For Query

Sep 14, 2006

I have written code to write a query with parameters set from selections made in a multiselect list box on a form.

I now want to add a check box for possible fields to include in the query and put these on the bottom of my form to allow users to select which fields they want to be displayed in the query result.

Can anyone advise how I can do this?

Many thanks,

Gary

View Replies


ADVERTISEMENT

Select All Query Fields For Main Form?

Sep 13, 2013

I have a table with about 3800 records and about 150 fields. It also has 4 tables with related data that each have only one field. I am going to create a query to base my from from. Should I just take the star * and get all the fields for each table or should i manually specify them. There are only about 5 fields out of the 150 that I dont need and I need to see the rest.

View 13 Replies View Related

Queries :: Form To Select Which Fields Show In Query

Oct 8, 2013

I want to create form with 10 checkbox, each checkbox is linked to a field "name, Address, TelephoneNumber, BuissinessName" I would like to know if it is possible for the user to check the box and then the field will show in query. if only name is check then only name will show in the query.

I have tried using [Forms]![Formname]![CheckboxName] as criteria but this didn't work it when I had more then one checkbox and when the one check box was not checked nothing showed in the forms.

View 5 Replies View Related

Select Fields For Query

Sep 15, 2006

I've made a form with list boxes on, the user's selections from which are taken as parameters for a query, created by VBA code.

I want to add a final list box to the form from which the user can select which of the available fields they want to see in the query output (i.e. has the same effect as checking/unchecking the "Show" checkbox for each field on the standard query design grid).

I have written the following code to try and do this, but it isn't working. I'm very new to VBA and wonder if anyone can help me out by showing me what's wrong?


'Build Field List
If Me!lstFieldList.ItemsSelected.Count > 0 Then
For Each varItem In Me!lstFieldList.ItemsSelected
strFieldList = strFieldList & "[" & Me!lstFieldList.ItemData(varItem) & "], "
Next varItem
strFieldList = Left(strCriteria, Len(strCriteria) - 2)
Else
strFieldList = "'*'"
End If

'Create Query String
strSQL = "SELECT Centres." & strFieldList & " " & FROM Centres " & _
"Where " & strCriteria & _
" And " & strCriteriaCtr & strSortOrder & ";"


Running the above gives an error, and the section under "'Create Query String" is highlighted in debug mode so I guess the error must lie there? Either that, or the earlier part where strFieldList is being create is generating something which strSQL cannot interpret.

Many thanks in advance if you can help me.

Gary

View 12 Replies View Related

Conditionally Select Query Fields

May 10, 2007

Is there a way to select a query field based on conditions? There is a table at work that I need to use for my reporting in which the field names are the months of the year. Since my report is monthly for that specific month only, I have to change my field in the query every single month. I would like to be able to put in some type of code that will automatically select the proper month field.

Is this possible?

Thanks! :)

View 2 Replies View Related

Query With Parameter To Select Certain Fields

Jan 12, 2008

Hi, I need help in creating a parameterized query.

I need to show only certain fields depending on the value of the parameters.
For example, I have a table with fields: ID, Name, Phone Number, Address, DOB.
The parameter can only be value of A, B or C.
If the user input A as the parameter in the query, only field ID, and Name will be shown
If the user input B as the parameter in the query, field ID, Name and Phone Number will be shown.
etc.

Is there any way to do this, rather than to separate the query into 3 queries for each of the parameters? Thank you.

View 1 Replies View Related

Adding Static Fields To A Select Query

Nov 15, 2005

I wish to add a static field to a select query i.e a field that does not exist within a table.

Does anyone know how I can do this?

Thanks

View 4 Replies View Related

Using Checkboxes To Select Multiple Fields In An Iif Query

Dec 1, 2005

Hi all,


Firstly, I'm an ex-fulltime access developer who has found himself doing access work again 6 years later; I can't actually believe how much I've forgotten :s

Anyway, I've done a search and havn't found anything that can help me so wondered if anyone could give some advice.

I have an access form with 3 combo boxes and a checkbox next to each of them. these are accessed using a query with 3 iif statements in it stating; (iif checkbox is null, "*", combo_box_value). the whole query looks like this

SELECT Customers.*
FROM Customers
WHERE (((Customers.Partner)=IIf(Forms!frm_rpt_main!check _partner Is Null,"*",Forms!frm_rpt_main!partner)) AND ((Customers.[Type Business])=IIf(Forms!frm_rpt_main!check_type Is Null,"*",Forms!frm_rpt_main!type)) AND ((Customers.[Year End Month])=IIf(Forms!frm_rpt_main!check_month Is Null,"*",Forms!frm_rpt_main!month)));

However, the query only seems to want to pull data from all 3 combo boxes

My issue is that if a checkbox is not ticked, I want the values to be ignored for all 3 combo's.

I've attached a copy of the mdb file as my description probably doesnt make any sense, the specific query is "qry_select_month_partner_type_wname_frm_rpt"


Thanking you all in advance for your help!

Younger

View 6 Replies View Related

More Than 255 Fields Management In A Select Query Of Access 2000

Apr 26, 2007

Dear sir/madam

I have two tables linked together with one-one relationship with primary key.
The form has been created using a select query using these two tables. total fields at present is 253(table1=25 fields, Table2=228 fields Total = 253 fields)

Now my problem is I have to add 20 fields more to the above. so the total fields now is 273 fields but it is not accepting and giving the error as "Too many keys defined 3190".

how to solve these problem

Thanks in anticipation
L.Ranganathan

View 14 Replies View Related

Select Query To Find Empty Date Fields

Jan 26, 2008

I am trying to create a select query on "ApprovedDate" where no approval is recorded. IsNull returns an expected type mismatch. Any ideas?
Regards:confused:

View 2 Replies View Related

Queries :: Allowing Users To Select Multiple Table Fields As Query Criteria

Apr 22, 2013

I am fairly new to Access and I would like to create a form to allow users to create their own query. I would like to allow users to select multiple fields (perhaps with checkboxes?) from all possible fields in a table to return either all data from that field or narrow their search by inputting certain criteria or choosing from a drop down into a text box. Is this possible in Access and any detailed specifics on how to achieve this?

View 3 Replies View Related

Select Form Record Set By More Than One Query

Mar 15, 2006

Hi,

I don't quite know if I am heading down a blind alley here. I want to filter a form to show a subset of the records via a toggle button. Click again and you go back to the full record set.

The form is based on a query and the filter is to be based on a copy of the query with several criteria and sorts added. This will result in a record set of active projects comprising about 20% of all records (65 out of 253). The sorting sets the record order to match the main management report and so the Planner can update the active records by navigating through the record set rather than having to search for each record using the Find button.

If what I am trying to do is not the way to achieve the desired result, I'd be grateful for any pointers elsewhere.

Regards,

Keith.

View 12 Replies View Related

Select All By Default For Query From Form.

May 11, 2006

Hey Folks,

I have a form with five combo boxes on it and one button, when each combo box has an option set and I hit the button, it runs a query which looks up the values of the form items and gives me my chosen information.

However, if these fields are: FirstName, Surname, State, Town and Road, and I want to only select on 4, 3, 2 or 1 of these - it gives me nothing.

So how do i specify that if the combo box is left blank just to select all.

So by putting data only into FirstName, say Eric, it will select ALL Surnames, states, towns and roads where the firstname is Eric.

View 2 Replies View Related

Editable Form With Select Query

Dec 17, 2013

I have a form with split view and data it taken from different table using join query, is there any way i can add edit form data and original table data gets changed.

View 2 Replies View Related

Select Multiple Criteria For Query On A Form

Oct 14, 2005

I was searching through here looking for a solution to the following problem:
I am building a Capacity database for work. The requirements require that users be able to sort by numerous criteria (Forecast Date, Portfolio, Market, Bucket, Month), all from a simple form that will spit out the results. Rather than creating unique queries for each combination of criteria(way too many!) or creating the SQL text in VBA, I played around until I came up with the following(which may have been done already, but I can't find it on here, so I'm not claiming to be brilliant...LOL). I have dropdowns on my form for each sort criteria-(Forecast Date, Portfolio, Market, Bucket, Month)

Then I created a query and for each criteria, I put this in:
Like (IIf(IsNull([Forms]![frmWAOFAdjustments]![Bucket]),"*",[Forms]![frmWAOFAdjustments]![Bucket]))

So if the user leaves a dropdown blank, the query simply brings back all the results from that field (Like *).

The text in bold is simply replaced with the dropdown name for each segmentation criteria. Next to each dropdown is a button that clears the dropdown box and requeries the listbox with the results(in case the user doesn't want to remove a criteria. This makes running searches for a specific number of accounts easy for the user and easy on me..lol.

Hopefully this can help someone out with a similar problem. I have learned so much from this forum, I just wanted to give something back. If anyone has any questions on this, just let me know.

View 2 Replies View Related

Cannot Get Query To Work With My Date Select Form

Jan 5, 2006

With the imense help of some of the people in this forum, I have scraped together a nice little database.
There is one function, however, which is not working.

I have a query that should run from a form I have created. The form has multiple criteria and all seem to be working except for the date fields... "First Order" and "Last Order".
The way I have it set up is that I have a table of dates. The form has a list box of the dates (first of the month, for 4 years).
The source data in the form reads: SELECT [TDateSelect].[StartDates] FROM TDateSelect ORDER BY [TDateSelect].[StartDates]; (for each of the 2 "minimum" dates)
and SELECT [TDateSelect].[EndDates] FROM TDateSelect ORDER BY [TDateSelect].[EndDates]; (for each of the 2 "max" dates)
The user is allowed to select a date range for the first order and the last order. (4 dates altogether).

The form looks fine.

In the query, I have set the criteria for the last date as:
Between [Forms]![FSetOtherCriteria].[MinLast] And [Forms]![FSetOtherCriteria].[MaxLast]

When I run the query (even with a wide date range) I get no results. When I remove the dates from the query, or enter the limits manually, the query works like a dream.

Any ideas???

View 3 Replies View Related

Query For Populating A Form Based On Different Select Criteria

Feb 20, 2006

Hi all,
I have a query which populates a form called EditPatientFrm, which asks the user to enter the patient UniqueID in order to pull up the record they want to edit from the TblPatient. However, I want the user to now be able to input just one of three criteria in order to pull up the record to be edited:

UniqueID
ChartNumber
PatientLastName and PatientFirstName (two fields)

since they may not have the UniqueID readily available to them.

Can anyone show me how to do this? I have tried to find answer to this one under queries and forms- no avail. Sure it's a simple thing...

thanks!
vrpres

View 1 Replies View Related

Select Record In Split Form Query Result

Mar 25, 2008

I have searched and search and I can't find the answer to this question when I thought it would be simple. Hopefully you can put me out of my misery!

I have a access 2007 split form with a series of search boxes and a query result window. Enter info into one or more of the search boxes, click search and you get the matching results in the query window below. That works fine but I want to work with the results of the query, how can I do this?

I was looking for the user to be able to select a record and then click a command button to open that record in a form. Or in another instance select a record in the result window, have the current from close and have the primary key passed to a another form which I use to open the split form.

I just can't see how to do it but I expect there are several ways. Happy to use VBA but my experience is with Excel VBA so I'm still getting used to the objects.

Thanks in advance!

View 4 Replies View Related

Running A Query Based On A Select Record In The Form

Jun 13, 2006

Hi,

I have a query that I would like to run from a form. I have created the button and the query, but want to add in a clause that will use the user selected record / field as the criteria for the query when its run.

Got any examples of code I could have a play with

I am struggling here so need any help I can get!!

Cheers
Paul

View 1 Replies View Related

Queries :: Combo Box On Form That Passes Criteria To Simple Select Query

Sep 22, 2014

I have a combo box on my form that passes criteria to a simple select query. There are four possible selections to make from the combo box. For some reason, when I select the first option on the list the query runs perfectly. However, if I select the second, third or fourth option from the combo box, the query returns no records, even though I know there are records in my table which should be returned.

View 5 Replies View Related

Queries :: Form To Select Parameter - Causing New Field In Query Design

Jun 16, 2015

I have a query with multiple fields that is being run off of 3 parameters (linked for selection in a form). The problem is, I wanted to enable a select all feature, so I included a "Or ... Is Null" part in my criteria section, so that when nothing is selected, the query/report returns all records.

Okay so the problem is whenever I run the query with nothing selected for the parameter and then return to design view for the query, a new field has been created in the query design, titled with the expression I use to pull the parameter value from the form. This is frustrating because then that is causing errors in another report I run that pulls values from that query.

View 1 Replies View Related

Combo Box Select With TWO Fields

Jan 28, 2005

I have a database of customers, and I'd like to be able to pull up a specific record on a form. Currently the only way I know how to do this is by ID number (the primary key). I'd like to be able to search by their last name and first name (of course we have people with the same last name), so for instance I'd like to be able to input "Smith" and then have a list of all the smiths to choose from. Is there a way to do this? Thank you!

View 2 Replies View Related

Import Problem Can't Select Different Fields

Nov 15, 2005

I am having a problem with Access, when I import a text file everything goes fine until I get to the screen after selecting to import into a new table. The one where you can rename the fields and select the data types and choose to skip the field. Here you should be able to select any of the fields and make changes, well when I select another field nothing happens it does not change to that field. See the attached image where field3 is picked but the field options still had field1.

Anyone else come across this or have any suggestions for fixing it? I guess I could reinstall Access but it's an office computer and would require getting our IT staff to do it since I don't have access to the Access install files.

The file will import fine if you go to finish but it loses data because the fields are not set properly for the data being imported, and I could always create a table first but sometimes it's just easier to do it at load time.

Thanks for any help,

View 2 Replies View Related

Select Latest Date From 4 Fields....

Jul 21, 2005

I have a simple table in Access 2003:

Case# (numeric)
CaseOpen (Date)
CaseClose (Date)
Item# (numeric)
ItemOpen (Date)
ItemClose (Date)

Some of the date fields may be null; If null then that date may NOT be selected

I am trying to write a query that returns:

Case#
Item#
Only the most recent date in any of the four date fields
The heading that matches the selected date field

ie:
Case# = 251
Item# = 4756
Most Recent Date = 7/8/2005
Matching Heading = "ItemOpen"

I have been searching and reading for two days-
Help, please?

TIA

View 1 Replies View Related

Select DISTINCT - Selecting Two Fields

Aug 9, 2005

Hi

I am trying to use a query to populate a combo box. works fine as I am using one table. I want to select DISTINCT records which works. However i need the ID of that record in the select statement. Anyone know how to select two things in a select distinct query??

Select DISTINCT tbl_Aplaws.Level2 FROM tbl_Aplaws WHERE tbl_Aplaws.Level1 = 'Business' ORDER BY tbl_Aplaws.Level2;

this works. but i need to select the tbl_Aplaws.AplawID as well. throws errors

View 1 Replies View Related

Modules & VBA :: Select All Fields That Contain Textbox Value

Oct 20, 2014

I'd like user to input what he's looking for in a textbox and then to filter all the records that contain that word.

values could be like rome, paris, belgrade

When user inputs rome, all fields containing rome should appear

tblTest like '%rome%'
should this work

tblTest like '" & Me.txtTest & "'
tblTest like '%" & Me.txtTest & "%' "

these give filters in report respectively :
tblTest like 'rome'
tblTest like '%rome%'

I might have something else wrong, but i don't get the desired results. No records are displayed...

View 4 Replies View Related







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