Populating Combo Box With Certain Select Queries

Jan 7, 2008

I have a form that has a combo box that contains every query in my database. This worked fine until i started having to create cascading queries to return the data I want. How can i populate my combo box with only certain queries in my database.

This is the code I was using to put all queries into my combobox.

FROM MSysObjects
WHERE MSysObjects.Name NOT LIKE "~*" AND
MSysObjects.Type = 5
ORDER BY MSysObjects.Name;

Upon clicking a button or clickin the query in the list, I want the query to run......So the main question is how to I include certain queries in my combo box but not all of them? I do not know SQL or any programming, so as specific as possible will help immensely. Thank you everybody.

View Replies


ADVERTISEMENT

Queries :: Populating One Combo Box Based On Selection In Another

Jul 20, 2014

I can't quite get my code right for populating one combo box based on the selection in another. I didn't create this Access database but I've been asked to add in a second combo box that is based on the selection of the first combo box.

My first combo box is for Rohe (the location of the Maori tribe) and the second is Iwi (the tribe name). So my first combo box (Rohe) has Dvic_ROHE written in the control source and its row source code is:

SELECT tblLookUpValues.DatabaseFieldValue
FROM tblLookUpValues INNER JOIN tblFormQuestionLookUp ON tblLookUpValues.LookUpID = tblFormQuestionLookUp.LookUpID
WHERE (((tblFormQuestionLookUp.FormID)=2) AND ((tblFormQuestionLookUp.QuestionNumber)=75))
ORDER BY tblLookUpValues.DisplayOrder;

The combo box for Rohe (tribe location) is populated by a table named tblLookUpValues. The second combo box for Iwi (tribe) has Dvic_Iwi in the control source. I created a table named tbl_Rohe_Iwi_lookup that contains ROHE (a list of tribe locations) and IWI (the tribes). There are 12 tribal locations and another 10-14 tribes in each location.
The form that the Rohe and Iwi combo boxes are located on is called frmDeceased. This is the code that I attempted to write so that the second combo box (Iwi) is populated with only the tribes that are in the Rohe (location) that was selected from the Rohe combo box. But when I run the query it comes back with no results.

SELECT distinct tbl_Rohe_Iwi_lookup.Rohe, tbl_Rohe_Iwi_lookup.Iwi
FROM tbl_Rohe_Iwi_lookup
WHERE (((tbl_Rohe_Iwi_lookup.Rohe)=[forms]![frmDeceased]![Dvic_Rohe])) UNION select distinct null, null
FROM tbl_Rohe_Iwi_lookup
ORDER BY tbl_Rohe_Iwi_lookup.Iwi;

View 5 Replies View Related

Queries :: Unable To Select Item From Combo Box

Feb 2, 2015

So I have this form with a combo box which successfully displays a range of items from which I would like to select from - but unfortunately I cannot. I cannot select anything from the combo box.

I have checked the form and table to ensure I have edit rights - which I do.

The form is based on a query - attached is a picture of the relationships within the query.

I assume I have created a non updateable query but this is only an assumption.

I am lost about the best course of action to take. Is there a way to identify the problem?

Do I just cut my loses and recreate the functionality somehow?

View 5 Replies View Related

Queries :: Combo Box To Select Required Search Field Value

Apr 11, 2013

I'm new user converting over from Lotus Approach. I'm using Access 2013.

I have a database with two tables being Suppliers and Products. This is a one to many type database with Suppliers being the one table.

Both tables have their own data entry forms.

In the Products table and data entry form is field named Category with a value list of about 20 different values. The query I need to create is to search on the field value from one of the listed values in the associated combo box.

I have set up the basic query using the Query wizard. To run This I have to entry the value I wish to search for in the Query in Design mode.

My problem is now I want to drive the query from a new form. On the new form I have created a combo box where the field list is the same as on the product data entry form.

I need to use this combo box to select the Category field value I need to search for and then click on the button to run the query. I seem to be stuck on the SQL code to achieve this...

View 2 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 Setup - Allow Users To Select Parameters Using Combo Boxes

Apr 3, 2014

I'm wondering is it possible to create a multiple parameter query which will return results even if you leave some of the parameters blank ?. I'm trying to set up a Form which will allow users to select parameters using combo boxes but at the moment you need to fill them all in or you'll get no results...

View 10 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

Populating Multi-select Items To A Text Field

Nov 27, 2005

I'm new to access. Hope someone can offer some help!

I have created a simple database to better organise some day-to-day office data management. For instance, I have a form (just) to record event attended by staff. The data would then be output as a brief report on overall office activities. Since it's event-oriented, staff attendance is just one complementary information. I went through most of the post re multi-select. I understand that it may not be a good idea to return values from multi-select list boxes into a text field, as it would be problematic for using data-analysis in the future.

In my case, I just need to have a text box, neatly (and easy for user, too) shows who attended. As suggested in one of the posting, I follow the instruction of http://support.microsoft.com/default.aspx?scid=kb;en-us;210203. But it doesn't seem working. I attach my databsae (sorry, it's very simple, as I want to test whether the multi-select work).

Your help would be greatly appr:confused: :confused: :confused: ciate!

Also, what about if I group option button, will it allow multiple return by the way?

delamerbleu

View 2 Replies View Related

Populating Combo Box Based On Data In Another Combo Box

Jan 23, 2006

Hi all!

It's been a while since I've used Access, and I seem to have forgotten this.

I have a form which allows entry of Borrower's details. I have 2 combo boxes on the form.

They are:

cboBorrName
cboLoanSN

Once the user selects the name from the cboBorrName, I want the cboLoanSN to display all loans associated with the Borrower so that they can select the correct loan and add repayment details accordingly.

I have added the following SQL statement as the record source of cboLoanSN

Code:SELECT * from tblBorrower WHERE tblBorrower.fldLoanSN=[Forms]![frmBorrower]![cboBorrName]

I have also added the following code in the After Update event of cboBorrName

Code:Me.cboLoanSN.Requery

However, it doesn't work.

Can someone please help me out?

Thanks a bunch!

View 6 Replies View Related

Forms :: Select Record On Subform To Select Default Value In Combo Box?

May 6, 2014

I have a subform containing a list of Funds and attributes such as Asset Type, Fund Manager, etc.

Currently, I have a textbox, where the the control source is set so that it will be updated with the Asset Type from the subform.

I also have an unbound combo box that contains a list of Asset Types queried from a table via row source, where user can select the Asset Type.

What I would like is when a record is selected from the subform, the Asset Type is selected on the combo box as a default value. User can select another Asset Type if required. How can I do this?

View 1 Replies View Related

Populating A Combo Box

Nov 23, 2005

On my form i have a list which takes information from a table. I have set column headers to "on". What i want to do is populate my combo box with the column heads in my list box. Anyone have any ideas?

Cheers,
Matt

View 1 Replies View Related

Queries :: Select Query To Gather Results Of Other Select Queries

May 11, 2014

I'm fairly new to Access. 's various select queries containing useful and useless results. I want to create a select query that will pick out all the useful figures into a 1 row table that can then be pasted into Excel.

e.g Existing Select Query 1 returns 1 row showing Average Age, Average Price, Total rainfall
Existing Select Query 2 returns 1 row showing Average Weight, Average Salary, Total snowfall
Existing Select Query 3 returns *2* rows: It returns Distance from London, Hours daylight and population for Town A and Town B

I want a select query that returns 1 row showing (6 items):

Total rainfall, Total snowfall, Town A Distance from London, Town A Population, Town B Distance from London, Town B Population.

I've been able to handle getting Total rainfall and Total snowfall. But I cant figure out how to get Town A Distance from London, Town A Population, Town B Distance from London, Town B Population to appear in the same row of the same query results as Total rainfall, Total snowfall.

View 3 Replies View Related

Populating A Combo Box In A Sub-form

May 8, 2007

Good day,

I have a main form with project data and a sub form that has related financial information. Once the user selects a particular project from the ProjectType drop down box, a field called Project Codes in the subform should be populated with only project codes for that particular Project Type.

Can someone assist?

Thanks

View 5 Replies View Related

Populating Combo Box With Last 5 Entries

Apr 8, 2005

Nubie question ( first real database)

I'm trying to populate a combo box with the last few entries of a record. I've been looking on SQL Queries and can see a way of using SELECT TOP on the recordset but querying/sorting the whole record every time seems a very clumsey way of doing it (especialy if the recordset gets large).
So is there a more elegant way of getting lastrecord,lastrecord-1,lastrecord-2, etc into my combobox ?.

Note as a suplemental question is there a way of a subform showing records from last to first instead of what seems to be normaly first to last?

Thanks for any help.

View 4 Replies View Related

Problems Populating A Textbox From A Combo Box

Jan 5, 2007

I'm really hoping someone can help me, as I'm about ready to tear my hair out at the moment!!!

After a few problems, I've managed to set up a subform with three cascading combo boxes (i.e. "Family", "Order", "Common species name"). However I want a fourth field (a textbox: "Latin species name") to update automatically when the value of common species name is selected, so that the appropriate Latin name appears in the textbox at the same time.

Subsequently, in the afterupdate event of the "Common species name" combo box, I put the code:

Me.Latin_Name = Me.Common_Name.Column(2)

(Where Common_Name.Column(2) is obviously the field containing the value for Latin species name.)

Which seemed to work fine.... for the first record at least!

The problem comes when I try to add a new record to the subform - and instead of resetting, the "Latin species name" value entered in the first record also carries over to all subsequent records.... and changing the value in any later record simply also changes it in the first (and all other) records.

Can anyone work out what I'm doing wrong here? Any help will be much appreciated!

View 6 Replies View Related

Values In Combo Box Not Populating On Some Computers

Feb 4, 2008

Hi,

Hopefully this is a really simple requiring a simple answer.... hopefully

On one of my forms I have a combo box thats values are generated by a parameter query. On my computer and a couple of others i tested it (on the same network) this combo box populates fine, but i put it on a couple of other computers today and it doesn't show any values. I checked and the query itself runs fine, plus a combo box that runs off a table populates fine.

not too sure if its relative but the database is split with the tables sitting on the network share and the database sitting on the main computer. or perhaps this could have something to do with blocking unsafe expressions.. i am not sure

any help on this would be greatly greatly appreciated

View 8 Replies View Related

Combo Box Populating Text Fields

Jul 19, 2006

Hi All

Been having trouble setting up a combo box in a form that displays data from the same line in the table into a text box.

I am trying this with a memo field without any luck. I am using a 2 column query for the combo box, the first column contains the name and the second contains the requirements (memo).

I have put in the after update code:

Private Sub CustName_AfterUpdate()

Me!CustReq = Me![CustName].Column(2)

End Sub

Can anyone please shed light on what I'm doing wrong?

Thanks

View 3 Replies View Related

Combo Selection Populating A Text Box

Nov 13, 2006

Probably an easy one here...I have a series of cascading combo boxes where once the last once it chosen, I'd like some sales info to populate in a group of text boxes. What command would I use for this?

Also, I have a checkbox that I'd like to use to either enable or disable a textbox as well. Any ideas?

Thanks!

View 12 Replies View Related

Urgent Help Please With Combo Box And Populating Tables

Oct 31, 2004

I am trying to create a database which will act as a timesheet and management system.

I have several tables set up. some are:
01-Staff details containing Staff ID, Names, etc
11-Timesheets containing Timesheet ID, Staff ID, Timesheet Period ID
17-Timesheet Periods containing Timesheet Period IDs, Start Date and End Date.
13-Hours containing Hours ID, Timehseet ID, Project ID, Hours
etc.

I want to set up a Combo that lists Names from Table 01-Staff Details, and when the user selects their name, enters the Staff ID on a new row in the tabll 11-Timehseets.

I am able to create the Combo to list the names from 01-Staff Details, but am not able to get the selected name to jump into 11-Timesheets. The field is not available in the Control Source.

Could you please assist? I am not an Access expert, nor have I done any programming, so a step-by-step solution would be greatly appreciated!!

Many thanks in advance

Sunil

p.s. I would then like to ensure that users can't edit data in certain tables (eg. they shouldn't be able to create a new Staff ID/name, etc)

My next task will be to create a sub-form (which I am able to do) where the user can select a project from a combo-box and enter the hours worked on it. I would like the project and hours to be entered on a new row under the table 13-Hours

I look forward to your reply!

Many thanks

View 4 Replies View Related

Populating A Text Box Using Combo Box Filter

Nov 18, 2004

Hello,
This is my first time posting here and I hope someone can help me. I am not experienced with coding in access and only recently started using forms.

I am trying to create a text box that automaticly fills in once a selection is made in a combo box.

There are only 2 tables and 1 form I am working with. Table 1 has columns "code" and "bu". The second table has several columns, all blank, that the form fills in.

The combo box is working correctly, it displays all the "code"s. Once the code is selected I would like a text box to display the "bu" column.

Any suggestions are much appreciated.

View 4 Replies View Related

Populating Form - Combo Box Or Alternative?

Aug 28, 2006

If any one can make a suggestion it would be great. I have a list of names with phone numbers, addresses and emails. I thought I could use a combo box to select the name and and have the other date associated with it come up in the appropriate boxes set. I can't get it to work. Does any one have any suggestions on how to make it work or another method that can be used. The out come I want is to allow someone to pic name from a list which will then set the phone number, address and email correct. Ideas would be great.

Thanks Tracey

View 1 Replies View Related

Forms :: Populating Textbox From Combo Box

Apr 28, 2013

I am trying to populate a textbox based on selection from combo box. Both fields are in two different subforms within the same form.

I do see the selection from the combo box fills via debug. I don't see a value in the textbox.

This is the code I am using:

Private Sub cboRequestedItems_Change()
Me.PricePerUnit.Value = Me.cboRequestedItems.Column(1)
End Sub

View 6 Replies View Related

Modules & VBA :: Populating A Combo Box From A Query

Oct 18, 2014

I am trying to populate a combo box (cboVenderID) with one of the two queries below.

But "Set rs = db.OpenRecordset(strSQL)" causes a Run-time Error '3016': To few parameters. Expected 1.

I am quite new to VBA and SQL.

Dim strSQL As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim intVenNum As Integer
intVenNum = Me.cboVenderTypeID

[code]....

View 4 Replies View Related

Populating A Text Field From A Combo Box Selection.

Apr 28, 2005

I have a combo where the list is populated with a bit of VB code to create a two field list. When the user selects the item they want from the list it displays the item in the combo box and should populate a text box in the same row with the value from the second column.

This combo is part of an orders subform and the user is selecting a product from the list which displays the product_name and the product_id.

The problem is that the product_id is not filled in and access returns the following error:
Run-time error ‘3101’:
The Microsoft Jet database cannot find a record in the table ‘product_table’ with key matching field(s) product_id.

This is the VB code that populates the list :
[code]
Private Sub comboCatagory_ID_AfterUpdate()
Dim sProd_description As String
sProd_description = "SELECT products_table.product_id, products_table.prod_description " & _
"FROM products_table " & _
"WHERE products_table.prod_catagoryID = " & "'" & Me.comboCatagory_ID.Column(0)
Me.comboProd_description.RowSource = sProd_description
Me.comboProd_description.Requery
End Sub
[end code]

What am I doing wrong?

Thx
Kev.

View 5 Replies View Related

Populating The Text Box’s That Relate To The Chosen Combo Box’s With The Sum Of A Cal

Sep 29, 2005

Hi, I'm in the process of building a program in access 2003 for estimating roofs, I've ran into a little problem, as described below. any suggestions would be very useful

Populating the text box’s that relate to the chosen combo box’s with the sum of a calculation.

In other words if X combo box is chosen (There are many combo boxes to choose from) populate xx text box with the sum of a calculation.

Refer to the print screen example of my program: http://www.roofmart.net/Rest.asp

Notice under the label felts the 15lb 36” felt combo box is chosen and it displays the value of 11 and next to the combo box is a text box that displays the value of 25 The calculation will be (11*25) = 275 this value of 275 must be added to the text box values that are being shown in the forms header under 30yr where it reads $4,606.80 and 40 yr $6002.80 only, this is because the 30yr comp and the 40 yr comp combo boxes are the only chosen roof types under the label roof types above the felt label.
Hopefully this makes sense.
Thanks -- Any help with be greatly appreciated.

View 3 Replies View Related

General :: Populating Combo Box With Delimited Field?

Aug 21, 2012

So I'm working on an Access 2007 application for my company's suppliers list, but I am restricted to using a single Excel worksheet for the back-end. One of the fields, called [Files], is a list of files in .pdf format related to a supplier. The number of files can be 0, 1 or many. I currently have this field set up so that each file is separated by a semi-colon. A sample first record in [Files] is:

K:Users est user2008-12-24-ASTM D5857-08.pdf;
K:Users est user2012-03-12APCPP25-Black.pdf;
K:Users est userDIN_16901.pdf

The front-end contains a multi-item form. I'm trying to add a ComboBox (cboFiles) for each record, which is populated by the value in [Files]. Then, selecting an item in the ComboBox should automatically open that file.

I've tried a few approaches so far for populating the ComboBox:
Setting [Files] as the Control Source results in a single item appearing as
"K:Users est user2008-12-24-ASTM D5857-08.pdf;K:Users est user2012-03-12APCPP25-Black.pdf;K:Users est userDIN_16901.pdf"

I also tried setting the ComboBox Record Source Type to Value List and created a hidden TextBox (txtFiles) with the Control Source set as [Files]. Then I used VBA in Form_Load to equate the ComboBox Row Source to the TextBox. The code is simply:

Code:
Private Sub Form_Load()
Me.cboFiles.RowSource = Me.txtFiles
End Sub

While this does create a ComboBox with the correct items for the first record, it also populates the ComboBox for all the other records with the same thing, ie. every ComboBox has the items:
- K:Users est user2008-12-24-ASTM D5857-08.pdf
- K:Users est user2012-03-12APCPP25-Black.pdf
- K:Users est userDIN_16901.pdf

I'm thinking maybe this approach could work with some modification in the code or approach. Unfortunately, I'm not too clear on why the code goes through all the Me.cboFiles.RowSource, but only once on Me.txtFiles or how to get it to check the txtFile for each row. Otherwise, I will need to figure out some other way to fill in the ComboBoxes.

Edit: Actually, I've noticed something peculiar. Each time I select an item from a ComboBox, the other ComboBoxes for the other records also change to the same item. I think this has to do with cboFiles being unbound. Changing it to bound doesn't seem to be quite right though as it just gives the same default values as txtFiles while the items are still just copied from the first cboFiles. Also, I can't actually select any of the items when it's bound. I imagine it might have to do with the read-only attributes of a linked Excel File.

View 6 Replies View Related







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