Modules & VBA :: How To Update List Of Values In A Combobox

Sep 25, 2014

I have a combo box which gets its values from sql server using a query which is called "get_query_reason", which works fine. Now I want to update combo box values based on a user selection, st string. Have written the code, but does not work:

Dim qDef As QueryDef
Dim Query As String
Dim st As String
Dim rs As Recordset
st = "SOV"
Set qDef = CurrentDb.QueryDefs("get_query_reason")

[Code] ....

View Replies


ADVERTISEMENT

Doesn't Recognise Values As On The List In A Combobox

Jan 24, 2005

Hi,

I have a table of records, with one field of the records a combobox populated by a select query based onanother table.

My problem ism that it doesn't seem to recognise any of the values as on the list, though deleting one character and then replacing it results in the value being accepted with no problems.

This is a database I have inherited (Cheers predecessor!), the table is populated with a few thousand records and scrolling through this table results in an error message on this field for every record and is making displaying data on this form a nightmare! Anyone know of the cause or of a quick fix?

I don't know the history of this table unfortunately.

Cheers in advance

John

View 6 Replies View Related

Subform Combobox To Only List Specific Values

May 22, 2014

I have an Employee's Development Objective main form , which has a subform that contains a combobox that lists all 'Job Titles' and 'Job Objectives' within the company, say such as:

Code:
IT Manager, Create Spreadsheets
IT Manager, Manage Staff
SQL DBA, Create Databases
SQL DBA, Create Spreadsheets
Managing Director, Manage Finance
Managing Director, Manage Staff

How do I get the subform combo box to ONLY display the Job Titles and Job Objectives specific to the Employees known Job Title? The combobox Row Source is presently:

Code:
SELECT qryJobObjectiveDetails.jobObjID, qryJobObjectiveDetails.jobTitle, qryJobObjectiveDetails.objective
FROM qryJobObjectiveDetails
ORDER BY [jobTitle], [objective];

The main form has a jobID number specific to the Employees job title.

View 4 Replies View Related

Forms :: Single Column Combobox To List Values From Multiple Fields

Apr 8, 2013

I have a data base with names, email IDs, phone numbers of 5 types(example quality, security, IT,finance etc) of person from ten different project teams. I created a basic form for the end user to enter values and created fields for each of the person's name, email ID etc based on the personal type( liek quality, IT, finance etc) on each team. The background table contains records of almost 200 people now.

All of these people will be trained for one task and some will be trained for multiple tasks. I know how to make the combo box allow multiple values/selections but, i cannot list out all 200 personal names in the combobox's rowsource/value list. Is it possible to combine all different name fields and list out all personal(of one team), so that the end user can just select multiple names for that team who have been trained and so on. i need to set the rowsource of the combobox to the values of all personal from one team so the team leader can just go select who has been trained and who has not.

View 1 Replies View Related

Forms :: Combobox In A Form To List Values Of A Field In A Table - Rowsource

Apr 14, 2014

So I have a combobox in a form that lists the values of a field in a table. The rowsource is this:

Code:
SELECT [Estes Training Modules].[Training Module], [Estes Training Modules].[Period] FROM [Estes Training Modules] ORDER BY [Period];

The problem is that ALL values on that field show up, including repeated values. I only need each different value to show up once. How can I do that?

For example, what I get in the combobox is: Annual, 2-Year, Annual, Annual, 2-Year, 3-Year,...

What I need is: Annual, 2-Year, 3-Year,...

View 10 Replies View Related

Modules & VBA :: Msgbox With Combobox Value Ii Not In List Event

Jan 23, 2015

I currently use this code to trigger a not in list event, ask the user if they want to add it to the respective table, and then add it.

I'd like to be able to add the text in the combo box that triggers the event to show up in the msgbox.

Private Sub cboCategory_NotInList(NewData As String, Response As Integer)
Const Message1 = "The data you have entered " & me.cbocategory.text &" is not in the current dataset."
Const Message2 = "Add now?"
Const Title = "Unknown entry in CATEGORY Field..."
Const NL = vbCrLf & vbCrLf

[Code] ....

View 2 Replies View Related

Modules & VBA :: ComboBox - Record Selection From List

Mar 25, 2015

I have 1 combo box contains 2 columns look-up directly from the properties(Not VBA)

Now i want to select record from the list

Example: i want to select PM-1234-1111 so i dont want to type starting letter PM to select but i want to type 234 or 123 or somewhere in the middle or end to filter that contained text in all the items is it possible?

Any Property settings or any VBA code?

View 1 Replies View Related

Modules & VBA :: Auto Select Values Combobox

Feb 19, 2014

I would like to let vba select all (one after the other) values in a combobox and run a query. The code has to be run using a Do While Loop for which I already made the condition.The reason I want to automate this is to allow the user to quickly add new links in the database. The combobox is used in multiple queries.I rather code it than make new queries for this situation because it involves many queries that would have to be added.

View 4 Replies View Related

Modules & VBA :: Combobox / Listbox Change Event Populate Values In It

Nov 21, 2013

I am trying to write a code that will execute at the change even of the combobox/Listbox and when a character is typed in it then all the data from "DocumentType" field whose first character matches with the first character typed in Combo/Listbox will be stored in it.

The following code doesn't work:

Private Sub ComboBox4_Change()
Dim strText, strFind As String
strText = Me.ComboBox4.Text
If Len(Trim(strText)) > 0 Then
strFind = "BarcodeRef like '" & strText & "*'"
End If

[Code] .....

View 1 Replies View Related

Modules & VBA :: Loop Through Values In ComboBox / Set Query Criteria / Export To Excel

Jul 24, 2014

I am a relative newbie to VBA, and not very familiar with loops, but I need to add a loop to my function that exports a query with criteria contained in a bound ComboBox on a form. I've gotten my code to work fine without the loop, but I would like to export one file for each item "Team_ID" contained in the ComboBox without the user having to manually select and re-run the function each time. Here is what my code currently looks like:

Code:

Option Compare Database
Option Explicit
Public Function CreateQCChartsforReports() As Boolean
Dim qdf As DAO.QueryDef
Dim strSQLStatic As String
Dim BookName As String
Dim BookName2 As String
Dim intCounter As Integer
Dim cboCode As ComboBox

[code]....

View 1 Replies View Related

Modules & VBA :: Wildcard Search Of Combobox - Lookup Values In Table Column

Nov 19, 2014

I have a form which has a combobox called Task_Ref which looks up values in a table column.

I would like to be able to set the tickbox value of tickbox called P1 to True if the combobox contains the word "test", each entry on the combobox selection may vary such as:-

Test number 1
Yesterdays Test

As long as the word "Test" appears I would like the above to happen?

I was thinking of something along the lines of:-

If InStr(Task_Ref.Value, "Test") > 0 Then
P1.Value = True
Else
P1.Value = False
End If
End Sub

But this hasn't worked

View 4 Replies View Related

Modules & VBA :: Exporting Query With Combobox Text Values Into Excel File

Sep 17, 2013

I a trying to search some product from a search button and two combo boxes text values ,and on serch the vba code is :

Code:

Private Sub Command4_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim varRecords As Variant

[code]...

I just dont know,the fuile is created on click of button but with headers only,dtaa is not coming but wheni debug ,in immediate window,data is oming but just not coming in excel file.

View 4 Replies View Related

Modules & VBA :: Grabbing Values From Search List Box

Jun 30, 2014

I was able to create a very user-friendly pop-up search form : {URL] .....

I would like to take it a step further... Now, I would like to grab the selected record ID from within one of the list box columns and use it in my SQL statement (to copy the record into a new one). Is there any way to reference a highlighted record value within a list box recordset directly and/or any workarounds?

I know one would be to grab the ID and insert it into the text box, just don't know what the coding references would be for this.

View 4 Replies View Related

Modules & VBA :: Deleting Values From A Table Selected From A List Box

Mar 19, 2014

Im trying to delete values from a table based on the selected values of a listbox. The listbox values have a hidden column which related to the ID on the table to which I am trying to delete from (if that makes sense).

If I use the following code:

Code:
Set ctl = Me.Results_listbox
For Each varItem In ctl.ItemSelected
CurrentDb.Execute "Delete * FROM Table1 WHERE Table1.ID = " & ctl.ItemData(varItem)
Next varItem

I get an error stating Object doesn't support this property or method.

View 7 Replies View Related

Modules & VBA :: Selecting Multiple Values From List In A Form

Dec 29, 2013

I am trying to use a list-control on a form to let the user select multiple values. I have understood that this requires some VBA-code to step through the selections in the list, since the "multivalue-selection" is set to "Extended".

When I try to execute the code I have (found and have tried to adjust), then I get the error message "Object required". The "ListCount"-paramater always only results in a ZERO-value, when i step through the code:

Function cmdOpenQuery_Click()
On Error GoTo Err_cmdOpenQuery_Click
Dim MyDB As DAO.Database
Dim qdef As DAO.QueryDef
Dim i As Integer
Dim strSQL As String

[code]....

View 9 Replies View Related

Forms :: Update Row-source Of Combobox Based On Value Selected On Another ComboBox?

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

Modules & VBA :: Update Select List Coding?

Jun 23, 2013

The coding below works fine. It presents a form with a list box of counties. Allows the user to select ALL, one or several counties and returns a query containing the clients from those counties.

The fields showing in the query are First, Last, Add1, FLAGToMap, City, Prov and Sector_Name.

I want to add in there a choice to select only the records that have are TRUE (-1) in the FLAGToMap field - just like the ALL button, this would be an ALL Selected Button let's say.

I would not know where to begin as I copied and adapted the coding below from a sample database and don't understand - at all - how the query is generated. The only coding in the form is the one below.

Private Sub cmdOpenQuery_Click()
On Error GoTo Err_cmdOpenQuery_Click
Dim MyDB As DAO.Database
Dim qdef As DAO.QueryDef
Dim i As Integer
Dim strSQL As String

[code]....

View 6 Replies View Related

Modules & VBA :: Need To Update Field Values Via Input Box

Aug 18, 2015

I'm trying to update the account number via an input box with a do loop but I don't have the code right. The at the input box, the user will type in a 4-8 digit number and it will update all the account number fields in a table that are null.

View 1 Replies View Related

Modules & VBA :: Using Unbound Form Values To Update Table

Jul 16, 2015

I have an unbound form in which a user enters data relating to a credit dispute, and when they hit the Save button I have a sub that is intended to insert that data into a table. This is a bit out of my comfort zone, so I found some code from another forum and adjusted it to my needs. However, I'm getting errors.

The table name is tbl_complaints. The fields from the form are:

txtAcctNumber
txtClient
txtEoscarType
txtEoscarControl
cboMethodReceipt
....

My code is below.

Private Sub cmdSave_Click()
Dim StrSql As String
On Error GoTo ErrorHandler
StrSql = "INSERT INTO tbl_complaints " _
& "(ACCT_NUMBER, CLIENT_NAME, EOSCAR_TYPE, EOSCAR_CONTROL_NUMBER, METHOD_OF_RECEIPT,

[Code] ....

The error I get is error number 3075, and it says I'm missing an operator in the section that references cboResponseType, but I can't seem to figure out what I'm missing. My head is spinning from staring at these parentheses and apostrophes for so long.

View 14 Replies View Related

Modules & VBA :: Update Table Based On List Box Multi Selected Records

Nov 24, 2014

I have database with an userform called AssignWP, combobox called WPDevBy, listbox called List352 (Multi select) and table called Justified.I am trying to update one field WPDevelopedBy of the table as combobox value based on list box multi selected records.

View 2 Replies View Related

Modules & VBA :: Update Hourly Rates With Exceptions That Use A Different List Of Rates

Apr 4, 2014

tblTimeEntry records individual time slips for attorneys keeping track of their time. Each slip records the client, attorney, time, rate, and value (time * rate) of the slip.tblPeople holds all the timekeepers and their current rate. Their rates change once a year.tblCustomRate will hold the exceptions,

How I imagine tblCustomRate will be set up is as follows (and this may be how it's wrong):Columns for each timekeeper. Each record is a client entry. When a new time entry gets entered, as it gets saved into tblTimeEntry, it should check to see if the client number is one that has a record on tblCustomRate. If it does, it should find the column for the timekeeper and use that rate. could add columns to the tblPeople for each client that gets a custom rate and use IF statements to get it to add, but that's a lot of legwork and code for a few clients.

tblTimeEntry
TimeID (primary key)
ClientID
TKFN (Timekeeper First Name)
Rate
Value

tblPeople
PersonID (primary key)
TKFN
CurRate (Current rate)

If it matters, this is Access front end with SQL Express tables. It's few and far between that I set up new People and it would be few and far between that there would be any custom rates (currently, there would be 2 out of 2000). People's rates change, but the time slips they entered at their old rate should stay at their old rate. If they were only worth $100/hour in 2010, but now they're worth $200/hour, the 2010 slips stay at the $100/hour rate.

View 4 Replies View Related

Queries :: ORDER BY - Update Values In One Table With The Values In Another Using Join

Sep 18, 2013

I have a query with an INNER JOIN and ORDER BY that is working great. Now, using the same JOIN, I need to update values in one table with the values in another. I thought it would be simple until I learned you can't do an ORDER BY with an UPDATE. Is there another way to achieve the same result? If you remove the 'ORDER BY', the statement below doesn't produce an error but the results are not correct:

UPDATE TableA INNER JOIN TableB ON (Left(TableA.CDN,6))=(TableB.CDN)
SET TableA.HCC = TableB.HCC
WHERE TableB.HCC Like '241*' AND TableB.BBB = 'X' AND TableA.CCC = "1234" AND TableA.HCC IS NOT NULL
ORDER BY TableB.HCC, TableA.CDN;

View 2 Replies View Related

Combobox List Condition

Jun 13, 2006

how do i make 2nd combobox list based on 1st combobox list, mean if i choose A at 1st combobox, only A1-A5 option appear, and when i select B at 1st combobox, only B1-B8 appear to select at 2nd combobox..

TQ

View 1 Replies View Related

Combobox List Sticks

Oct 4, 2006

I have a form with a subform in datasheet view with a combobox on it. When a user presses the Arrow to dropdown the menu it will stick on the screen after they leave the field. Any idea's?

View 3 Replies View Related

Combobox With Value List In A Report

Sep 13, 2004

I want to have a combobox in a report ,

In a report using a query with a field named: "plantno" and as criteria" :Like [Fill in the plantno]
I can put in a plantno.That is working Oke!
I want to do the same thing as above but then that i want to see
a combobox with a few plantno,s which are put in a valuelist,so that i dont have to type in plantno,s
but that i only can choose out a valuelist.

Who can help me?

View 2 Replies View Related

Can Combobox Value List Be Altered At Run Time?

Feb 6, 2005

Is it possible to alter the values displayed in a combo-box dropdown at run time. I tried using the following bit of code in a listbox's 'After Update' event , but it does not alter the combo-box's value list.

dim strSponProjStatus as string
dim StrNonSponProjStatus as string

strSponProjStatus = "Seed ; Growth; Consolidation; Phase Out; Closed"
StrNonSponProjStatus = "Under Nego;Funded;Part Funded;Suspended;Unfunded"


Me.cboProjectStatus.RowSourceType = "valuelist"

If Me.cboFundingSource = "Sponsorship-ADP" Then
Me.cboProjectStatus.RowSource = strSponProjStatus
Else
Me.cboProjectStatus.RowSource = StrNonSponProjStatus
End If



Any suggestions as to why this is not working?

Cheers :eek:

View 2 Replies View Related







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