Update Combobox

Jun 7, 2005

I have a combo box in a form that uses a query to access values from a different table, and dispaly them as choices. This works great. The first problem I encountered was if the value that was needed to be entered was not in the list, then there should be an option to add it. I found a couple good examples by using the NotInList definition to achieve this. And it works, when a new value is added, a message box comes up asking to enter the info in the database and the needed form then pops up. But when I close the form, the value is not in the combobox. Now I also researched this for a while, and found out about the function ComboBox.Requery, but I don't know where to put it to work.

Here's a more code definition of what I'm trying to do/have:

Private Sub Building_NotInList(Newdata As String, Response As Integer)
If MsgBox("""" & Newdata & """ is not in the customer list. Add it?", 33) <> 1 Then
Response = DATA_ERRCONTINUE
Exit Sub
End If
DoCmd.OpenForm "addbldgform", , , , 1 'Data Entry Mode
Response = DATA_ERRCONTINUE
End Sub



I was thinking about putting the ComboBox.Requery inside the AfterUpdate of a field in the addbldgform, so that when a new entry was added it would update by writing this in the AfterUpdate:

Form!buildingPractice!BuildingID.Requery

but that gives me an error saying that the field buildingPractice can't be found, when it is really a form with the value BuildingID (the name of the combobox that needs to be updated)

Sorry about the long definition, I just wanted to be clear, hope someone can help out.

- kevygee

View Replies


ADVERTISEMENT

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

Update Combobox - Subform

Jun 20, 2005

I have a form called NewRequisitions that had a combobox in which the users select the Supplier (name, address, shipping details). I created a button to open a subform called NewSupplier so that they can add a new supplier to the Supplier table as needed. My code works okay for the first "NewSupplier" entry - the table and combobox are both updated and the new supplier is available for selection in the dropdown list. However, when there is a 2nd record that needs a NewSupplier added the combobox list doesn't get refreshed. The record is added into the table okay but you can only view it if the NewRequisitions (main) form is closed and then reopened.

Here is the code in my subform:

Private Sub Form_Close()

If CurrentProject.AllForms(NewRequisitions).IsLoaded Then

'save the record if there have been any changes
If Me.Dirty Then Me.Dirty = False

'requery combobox on other form
Forms!NewRequisitions!ComboSupplier.ReQuery

'yield to other events - and put the new list into use
DoEvents

End If

End Sub
-----------------------------------

Any assistance would be greatly appreciated!!!

View 7 Replies View Related

Update ComboBox Based On Another

Jun 8, 2006

I currently have a table with two important fields (lets call them X and Y) currently I have them set to ComboBox where they reference two look up tables. I then have a form that allows for user input. Each of the two fields work with drop down lists. What I want to to is filter the Y Field based on the selection in Field X.

I wrote a query that is set to the Second combo box. WHen the user selects the drop down it runs the query and uses the value in the first to narrow the selection.
[forms]![DATA_ENTRY]![HOUSE_NUMBER]
THis works great but only for the first go through. After that it seems that I have to have code on one of the events. Basically any time the user hits the drop down I want to requery.

Does anyone have any code examples that I can reference that will show me how to repopulate that second combobox based on the selection from the first combobox? EVERY TIME I CLICK THE SECOND DROP DOWN BOX ....I would imagine that I have write the code on one of its events...

Does that make sense?

Any help would be greatly appreciated.

Thanks in Advance

View 2 Replies View Related

Trying To Place 2 After Update Procedures In 1 Combobox

Oct 4, 2005

Hello, I ran into another programming road block.
I currently have a combo box that is bound to a table with 2 fields and has 4 different options/records in it, with an after update procedure, that has different calculations for each record. I want to add a Dlookup command that will display
the record that is chosen and it will need to be placed in the
after update procedure of the combo box also. Is this possible?

Code that is currently in the after update procedure of the combo box.

Dim prp As Property, ctl As Control

Set prp = Me!cboRidge.Properties("ListIndex")
Set ctl = Me.txtRidgetot

If prp = 0 Then
ctl = ([txtridge]*100/30)+0.4
ElseIf prp = 1 Then
ctl = ([txtridge]*100/45)+0.4
ElseIf prp = 2 Then
ctl = ([txtridge]*100/30)+0.4
Else
ctl = ([txtridge]*100/30)+0.4
End If

Set ctl = Nothing
Set prp = Nothing

Code I need to add:

Me.DLookcbotile.Requery


Thanks-- any help will be very appreciated.

View 1 Replies View Related

Select From Combobox Then Subform Update

Nov 9, 2005

plz help me how to do it...

plz look at tables
i have "monthyear" & "partno/details and month" table

i cant open all part that have same month at table monthyear...
but i can open n view customer that bought same part at partno/details...

then i cant create form from table Monthyear..i want to create form as form "test"

plz help me...
am i need a coding?
can u show me the coding?
i'm new...plz..

ahh. cant post my DB....my db size to big...700kb after zip
cant i post screenshot? :confused:

View 1 Replies View Related

Forms :: Update Table Via Combobox?

Mar 20, 2013

I have a form with a Combobox that gets it's data from the table 'countries' and stores information in accounts.

Now I would need data entered in the cobobox to be checked against the table 'countries' if the data already exists...

if a.) yes - then all good
if b.) no - then new entry should be added to table and combobox (after confirmation)

View 6 Replies View Related

Forms :: Lock The Combobox After Update

Jun 3, 2013

The company's register of projects we select the customer from a combo box that is related to the customer table. However, the way this works now, the individual may choose another customer by mistake, and if this is not corrected at the time the project will be listed with the wrong customer.

I would like to have a feature that when you select a customer receive a message if you are sure this is the right customer and if you answer yes then the customers name is being locked to this project ID.

View 5 Replies View Related

Update TxtBox With Combobox Description And Not ID?

Jun 7, 2014

I have a form that has a combobox and a field text. If i select any value in combobox i want to update the txtBox but not with the ID of the selection. I need to get the description of the combobox selection which is essentially the Column 2.

View 3 Replies View Related

Password Protecting Table Update From Combobox

Feb 7, 2006

I have a combobox on a form which is populated from a field to present a list for the user to choose from.

I have limit list set to 'N'

When the user types something in the combobox that is not in the field in the table then I want to prompt for a password. Effectively password protecting the update of the field from a combobox.

If the password is correct the text is written to the field in the table and if not then not.

Help ?

View 9 Replies View Related

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 2 Replies View Related

Queries :: Update Data In Combobox Using Query

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

Forms :: Using Combobox In Continuous Subform To Update A Record

Feb 25, 2014

I have a continuous subform of 'static data' whose record source is a SELECT query across multiple linked tables.

Most of the fields are locked and purely there for information purposes but I need to be able to allow end users to change one particular field in each record if they need to - choosing a value from a predetermined list (i.e. one of the tables)

Usually, when I need to do this, I add a command button to the subform and use that to open a separate pop-up form specific to that record, from which the user can make whatever changes they like and then update the record. So in this scenario, a simple unbound combobox linked to that table, on that separate form, would work quite easily.

But I would prefer if users could make their changes directly from the subform without (yet another) pop-up form required each time, to make managing these records more fluid and less time-consuming.

So my thought was to use a bound textbox in the continuous subform (to take the existing value for each record), hide it and overlap it with a visible unbound combobox whose row source is the table of available options and whose default value is driven by the hidden bound textbox. And then to use the AfterUpdate event of the combobox to run the UPDATE query on the record in question.

However, while the combobox is getting the correct default value and the correct list items, I can't make a selection from it. Now I am aware there are 'issues' with using a combobox in a continuous subform but I was hoping I could circumvent them by not binding it.

View 14 Replies View Related

Forms :: Log History Of Inputs - Using ComboBox To Update Memo Field

Jun 25, 2013

I am currently using the column history to log the history of inputs into a memo field.

But i now need to swap how my database runs and now require a combo box to have the same history function, as this is for a status updates and i require users to only input certain status's.

I no that I cant use the columnhistory command with a combo box.

When selecting a status from the combo box it automatically update the memo field (which will be hidden on the form) so the column history function works.

View 1 Replies View Related

Using Combobox Name Selection In Login Form To Update Fields In LoginEvent Table

Apr 23, 2013

I have a login form with a combobox which derives its list of values from an EmployeeRecord table (i.e., last name, first name, securityID, job grade and record number): only the last name and first name appear in the list. (I swiped some VB code for a multiuser login form and routine from several previous posts.)

After it performs the security validation/authorization, it then opens a navigation control form based upon the user's job grade. It runs after the click button event. To this I would like to update another table, LoginEvent, with the last name, first name and record number from the combobox selection, and also add the time and date of the click.

View 2 Replies View Related

Saving Contents Of Combobox As String, And Inputing In Another Combobox

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

How Can I Filter One Combobox Based On Another Combobox Selection?

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

Combobox Based On Previous Combobox

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

Combobox Depends On Input Of Other Combobox

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

General :: Saving Data - Update Or Cancel Update Without AddNew Or Edit

Apr 13, 2013

My membership database has worked fine until recently. Now I cannot save inserted data. On attempted saving "Update or CancelUpdate without AddNew or Edit" appears.

The problem. relates to 2 tables Member and Addresses. PK in the parent table Member is ID. In the Addresses Table the FK is ID. There is a One to One relation between the tables and Referential Integrity is set. I know 1 to 1 is not good but it worked fine in this small database.

Browsing the all of the existing records is fine.

View 9 Replies View Related

Can I Get An Update Query To Not Add Records To Tables Only Update?

Jun 28, 2005

Hi Guys,

I have got a query that updates details from one table2 to table1, "Reference" is the primary key and this is what the query uses to determine which need updating.

It all works great but if table2 contains a record in "Reference" that is not in table1 i just want it to ignore it, currently it just seeems to add them.

Any suggestion guys & gals?

Many thanks
Tim

View 9 Replies View Related

Using Criteria To Update Fields In A Update Query

Nov 29, 2006

Ok, i have a question about update queries.I have two tables (I'll call table 1 and table two for simplicity) and an update query. I want to get some data from table one to table two (via an update query). But in table two there is a field that isn't in table one but i want to add a value to that field via the query.My question is, can i manually put into the query what data to add to a field instead of/aswell as using data from other tables.I hope you understood my questions.Cheers

View 3 Replies View Related

General :: Update Or Cancel Update Without Add New Or Edit

Nov 3, 2013

I get an error "update or cancel update without add new or edit" which seems to point to this code.I am using MS Access 2010.

Code:

Private Sub Form_BeforeUpdate(Cancel As Integer)
'Store when record was last modified and by who.
'Initially stores when the record was entered.
If Me.NewRecord = True Then Exit Sub 'Exit if new record
Me.DateLastModified.Value = Now()
Me.LastModifiedBy.Value = getUser()
End Sub

View 2 Replies View Related

Update Queries Update Message

Mar 30, 2006

I am trying to stop access displaying the "You are about Update 1 Record" etc message when i run an update query. I know i can do this in Tools/Options screen but the problem is that the database is going to be used by multiple users, and rather than changing each persons Action query option I was wondering whether there is something i can put in to the code Globally to halt the message.

Any help would be appreciated.


Regards
Mark

View 2 Replies View Related

Update Query Won't Update In Access 97

Feb 10, 2008

I am trying to remove random characters from a field. The field [assycode] contains a string similar to say, FGEJBF1 or ABFGYRUKC I want to remove any occurrence of "F1" normally at the end of the string but not always at the end. I used: Like "*f1*" to find the correct records, that worked fine, I then used [Assycode]-" f1" in the update to box, It wants to update 146 records I click ok then it says It couldn't due to a type conversion error. Just messing around I tried adding "F1" to these records using [Assycode]+" f1" and it worked fine. Can anyone point me in the right direction?

Thanks in advance

Wayne

View 5 Replies View Related

Using Update Query To Update Values

Oct 3, 2007

I have a database where two tables contain information that I need to update based on the 4 right most digits of a field. There are only 11 values that will need to be updated out of a large list of values. I'm not quite sure how to set up the update query so that I can do this.

View 1 Replies View Related







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