Combo Box Performs Query, Update Combo Box With Only Result?

Aug 4, 2006

Here's the deal:

I'm an extreme newbie, I do not know access very well, nor do I know VBA, I do know PHP.

I have a for in access that has 2 user input fields, one for prodid one for shipid. I have a combo box that upon entering data into the previous 2 fields, it does a query against an MsSQL database looking for a record that has both. In any case there will only be 2 outcomes, either 1 record, or null. I would like to have that same combo box automatically use the result as it's value so that users don't have to check the box, because they won't, and so that the rest of my VBA will be able to function properly.

Can anyone assist?

Thanks.

View Replies


ADVERTISEMENT

Table And Its Query Reflect Combo Box ID Equivalent Not Text Result

Mar 10, 2014

Whats the best way to show the text result of a combo box selection when displaying the information through a query? I notice the table is also reflecting only the numerical ID result of the selection so I'm not sure how to take this result and display it as a text result to the user.

View 7 Replies View Related

Combo Box Query To Post Result To A Seperate Query

Sep 27, 2006

Hello, I have a combo box on a form which lists some names generated from a table.

I would like the selected name to be inputted into the 'critera' of another query called 'qryPBCustLevel' and for that query to be run.

I have tried to code this, but it is crashing at the point it trys to add the name into the query.

Can anyone help? Code listed below.

Sub cmbPB_AfterUpdate()

'Set the Dimensions of the Module
Dim strSQL As String, strOrder As String
Dim dbNm As Database
Dim qryDef As QueryDef
Set dbNm = CurrentDb()

'Constant Select statement for the Query definition

strSQL = "SELECT DISTINCT tblTempPB.PB_NAME" & _
"FROM tblTempPB"

strOrder = "tblTempPB.PB_NAME;"

' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[PB_NAME] = '" & Me![cmbPB] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark

'Pass the QueryDef to the query
Set qryDef = dbNm.QueryDefs("qryPBCustLevel")
qryDef.SQL = strSQL & " " & strOrder

'Open the Query
DoCmd.OpenQuery "qryPBCustLevel", acViewNormal

End Sub

Thanks, Steve. :confused:

View 2 Replies View Related

Update Query & A Combo Box

May 2, 2007

Hello again all... Today's problem is as follows.... I have an "after update" combo box that is coded as "CurrentDb.Execute "Uno", dbFailOnError". I have an update query which I am trying to have a combo box from a form input information, update a table with what the combo box was inputted with. (if you follow). In my query, I have one field as showing the "Update To:" filed as "Forms![Loc-1L]!Combo8". When I try to run the query, it works in the query if I manually type in a location, however when running it in the form, it gives me the error: "Too few parameters. Expected 1". Any ideas where I'm going wrong?

View 2 Replies View Related

Update A Query In A Combo Box

Apr 3, 2007

--------------------------------------------------------------------------------

I have a form with two drop downs (combo box) School and Players. The first drop down I select a school. After I select the school, I go to the next drop down (combo box) and select the players I want. When I go to the second combo box (players) its has a query that runs for me. It takes what ever school I select and only gives me the players from that school.
However, lets say I made a mistake and I selected the wrong school, I go back and select the right school, but when I go to players box, its shows me the players from the previous school.
My questions is, how do you run the query in the form again after you have select a school? When I go to a new record to put in the information, the same thing happens to, I get the players from the school I selected the first time

View 2 Replies View Related

Forms :: Update Combo Box Query On A Form?

Sep 11, 2013

I have a simple form with a combo box linked to a field on a query and command button with vb code to open a report based on the value of combo box. The command button also includes code to requery the value of the combo box so that what was already generated in the report will not display when generating another report. Since the requery is tied to the command button, there is a delay in requery of the combo box vallue unless I click the command button twice to remove the report already generated. how to apply the requery to the combo box so that when I click my comman button, the requery process will work without me having to click the command button twice?

View 1 Replies View Related

Queries :: Combo Box Result And IIF Statement

Mar 22, 2013

I have a combo box as a value list and all the values apart from one are valid data entries in the table but I want to combine two of the values and then get the query to run if the combined values are selected. The value list is this:

(All);Brand1;Brand2;Brand1 & Brand2;Brand3;Brand4

The criteria in my query is this:

IIf([Forms]![MyForm]![Brand]='(All)',[MyTable]![Brand],IIf([Forms]![MyForm]![Brand]='Brand1 & Brand2',"Brand1" Or "Brand2",[Forms]![FrmCustomListATM]![cbBrand]))

Its the OR part that doesnt work.

View 9 Replies View Related

Queries :: Key Criteria Into Combo Did Not Show Up Any Result

Jan 22, 2014

I set my query criteria to my [Forms]![Form1]![Combo4].

After I key a criteria into combo4 , then I open again the query table ,

It did not show up any result , why ?

No combo4 don't have any event.

View 1 Replies View Related

How I Can Take Text And No Number In Result That Arises From A Combo-box Into A Searc

Jun 11, 2007

How I can take text and no number in result that arises from a combo-box into a search form?

View 5 Replies View Related

Forms :: Scan Barcode To Choose Item From Combo Box - Populate Textbox With Result

Jun 14, 2013

I'm working on a project that uses a barcode scanner. The user will scan a barcode which will choose an item from a combo box. The result of what it enters will populate a text box. I have that part working fine.

The next step is to get it to open a form based on the value in the textbox. The textbox will have about 7 different possible values and each one should open a different form.

The way this is supposed to work:

User approaches a machine and scans the barcode. He is presented with a form giving him options based on the type of equipment the machine is. A compressor for example would present him with a set of options for compressors (gauge readings, maintanence, etc).

I have an unbound form with two controls:

cboAssetNumber
txtType

How to code this and which events to code it in. Users will be going from machine to machine and using the form over and over again so I need to somehow manage the clearing of the form to begin again with another barcode scan.

I saw another thread about a barcode scanner and one response was to program the scanner to send the barcode and then send an "Enter" press to move focus to the next control. I've looked through the documentation and haven't been able to find if that is possible. Right now it sends the number and that's it. It's a "Motion" Tablet.

View 14 Replies View Related

Update Query Based On Another Queries Result

May 14, 2007

I currently have the sql below...
UPDATE tbl_Node_List INNER JOIN qryUpdate_P1 ON tbl_Node_List.Zip = qryUpdate_P1.[Zip Code] SET tbl_Node_List.[Date Sent] = (SELECT [MinOfAudit Date] FROM qryUpdate_P1), tbl_Node_List.[Date Recv'd] = (SELECT [MaxOfAudit Date] FROM qryUpdate_P1)
WHERE (((tbl_Node_List.Zip)="35243"));

but I get an err.msg stating the operation must use an updateable query.

What I am trying to do is update my dates in 'tableA' with the max and min values stored in 'tableB'. I have read some of the posts but still can't quite get it. As always all help is appreciated.

View 2 Replies View Related

Queries :: Field Is Empty - Query To Update Table But No Result

Feb 26, 2015

I have a created a query which I want to update a table. The field is called DTP. I have the Workingdays2 module in place as well as the Holidays Table. The dates (date only) are called Time in and Transaction date. I want the table to update records only if the entry in Completed is Yes. I have attached screenshot of what I have in query. I am no good whatsoever at VBA so I used the Query design view. It shows how many records will be updated (which is a valid number) and shows me which field will be updated. However when I run the query and then opend the Table the DTP field is empty.

View 2 Replies View Related

Combo Box Update

Jun 20, 2005

Hi All,

I have a combo box on my form that is retrieving its list of values from a table. After I choose a value I want to write it to another table's field. I can get this to work where it is writing to the other table's field, but when I open the form to see the field of where the information is supposed to be writen to it is not refreshing. What property on the combo box should I used to ensure that the field of the other table is instaneously updated when the combo box's value is chosen.

Thanks
Greg

View 3 Replies View Related

Combo Box - Before/After Update

Jul 12, 2005

Hey All

I have a following problem - the user selects value from a combo box (cmbPrio), if there was already a value in there, new value get added, and no further action is made.
If there was no value, value is added, AND in txtDueDate date gets added (if user selected High - todays date + 5 days, if low - todays date + 10 days)

I was thinking of doing it the following way, but it doesn't work --
Value XX is not saving the data. Should it be maybe done for a different event ? And I also don't get the correct date...


Before Update
If isNull(cmbPrio) then XX = 2


After Update
If XX = 2
If cmbPriory.text = "High" then txtDueDate = Now + 5
If cmbPriory.text = "Low" then txtDueDate = Now + 10
End If

View 3 Replies View Related

Combo Box Update

Dec 9, 2006

I have a form that displays a list of users and there programs in a sub form, I would like a combo box instead of the user ID number so that I can press on it and all the user ID's will appear, then I can select it and there details will apear. Can this be done?

View 6 Replies View Related

Update Unbound Combo Box

Apr 21, 2006

I said I was a dummy, but here goes.

I am designing a customer information form, the form has an unbound combo box showing customer names and when clicked opens the customer record.

My problem is when I enter a new record, I have a button that saves current and opens new, but when I am in the new record, the customer I just added previously is not showing up on the unbound control, only when I close the form completely and re-open it.

Is there a code to update the unbound combo box when you click to go to new record.

View 3 Replies View Related

Recordset Update From Combo

Jul 17, 2006

I want to update a field (field1) in each record of a recordset (qryUpdate)

I got the following code (in green) working fine - so far so good. I actually need to update the field from a selection from an unbound combo box. This looks up a table with two fields Period ID (autonumber PK) and a text field called Quarter. I've tried various combinations including the code in red and code such as
"rst![field1] = Me.cboPeriod"
"rst![field1] = Me.cboPeriod.Column(0).value" etc

but can't get it to work. It has to be something simple but I can't see it.


Private Sub cboPeriod_AfterUpdate()
Dim rst As DAO.Recordset

Set rst = CurrentDb.OpenRecordset("qryUpdate")
Do Until rst.EOF

If IsNull(rst![field1]) Then
rst.Edit
rst![field1] = 5
rst.Update
End If

rst.MoveNext
Loop
End Sub




Private Sub cboPeriod_AfterUpdate()
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("qryUpdate")

Do Until rst.EOF

If IsNull(rst![field1]) Then
rst.Edit
[rst![field1] = Me.cboPeriod.Column(0)
rst.Update
End If

rst.MoveNext

Loop

End Sub

View 3 Replies View Related

Update 2 Fields With 1 Combo Box

Sep 2, 2005

Hi,
Hope someone can help. What I’m trying to do is have a combo box look up values from one table and add them to another. I have used the combo box wizard to look up a value from table1 and add it to table2 but is there a way that it can lookup 2 values and add them to the second table. For instance if I had to tables like :-

Table1
First Name
Last Name

Table2
First Name
Last Name

Can a combo box lookup and update both fields for example if I have a combo looking up the first name can it also lookup the last name and add them to the corresponding fields in the second table but with the user only selecting the first name in the combo box.

I’m sorry if I don’t make much sense I’m new to access and fairly new to forums

Thanks for your help

View 1 Replies View Related

Before Update With Combo Boxes

Jul 27, 2006

i have a form that i want to stamp with a date when it was last updated. if a change to the form is made it will be stamped with today's date. i used the BeforeUpdate event so that you could choose to save the edits or not so if you didn't mean to edit a record then the date would not change. the code is:
Dim myVar As Byte
myVar = MsgBox("Changes to this issue have been made. Would you like to save the changes?", vbYesNo + vbQuestion, "Save Changes?")
If myVar = vbYes Then
[LastUpdate].Value = Date
Else
Me.Undo
End If


my problem is that when i change the combo box values it will run this event and ask to save. i think the reason this is happening is because the comboboxes save when you change them. how do i accomplish the same task as above but allow the combo boxes to act like txt boxes?

also is there a way that when i ask if the user wants to save or not, to have a cancel button that will take no action, leaving the record open the way it was (new typing and everything) before the user tried to close the form without saving that info?

View 14 Replies View Related

Update Combo List

Sep 26, 2006

ok i have three tables..

Booking_Table
Booking_ID
Job_Date
Company_ID
Booker
Passenger

Company_Table
Company_ID
Company_Name
Address
Phone_No

Company_Staff_Table
Company_Staff_ID
Company_ID
Full_Name
Phone_No


each booking will only ever involve one company at a time

company 'A' will have several staff

person 'A' from company 'A' may book a job for themselves

person 'A' from company 'A' may also book a job for person 'B' from company 'A'


i have created a booking form

i have added a combo list displaying all the company names..(control="comp_combo")

i have also added a combo list displaying all staff names from all companies (control="staff_combo")


when the user selects company 'A' from the first combo.. i would like the staff combo to update and only display staff members for that company

how do i do this.

View 1 Replies View Related

Update Subform With Combo Box...arg

Oct 18, 2006

This is so simple but I can't seem to make it work. I've poured through about 30 posts and tried all kinds of AfterUpdate event strings to no avail. Help!

Here is the simple setup. I have one table that lists employees and their corresponding teamleader. A grouped query provides the record source for a combo box. The idea here is that you select a teamleader from the combo box and a subform updates to show all the corresponding employees. This subform is based on a simple query of all fields on the table.

combo box = cboteamleader
mainform = frmTechMaintenance
subform = frmEmployees

I've finally settled on this...


Private Sub cboteamleader_AfterUpdate()

Me!frmEmployees.Requery

End Sub


...as having the greatest chance of success based on other posts. Not sure why it doesn't work. It just doesn't update.

View 6 Replies View Related

Disable Combo Box After Update?

Jan 5, 2007

Hello,

I have been playing around to see if it is possible to operate a combo box as a one shot operation.

I.e you make a selection from the combo box then the combo box is disabled.

Only prob is that I can't figure out how to do it.

Possibly by using a message box to see if selection is correct, if Ok clicked
then data entered and comboboc.enabled = false?

Or can this not be done.

B

View 2 Replies View Related

Automatic Update Using Combo Box

Dec 6, 2004

i have several fields i would like automatically updating with data from a combo box.
at the moment i can only update one. the combo box relates to a query on one table,
the fields i want updating are on a second table. is this possible?

View 1 Replies View Related

Update Subform Using A Combo-box

Jan 19, 2005

Hi,
I am trying to update a subform by selecting a record in a combo-box that corresponds to a particular test when i select the said test i want an adjacent subform to change to the form displaying the test data in the subform window i have tried to use VBA to achieve this but so far have been unsucessful does anybody know how this can be done?

Regards
Gavin Cleary

View 1 Replies View Related

Combo Update Problem

Apr 4, 2005

Good day all,

I have a problem when updating a combo box on a form. I open the form from a command button on another form (No problem) when I update the combo box on the new opened form Access acts like the record set is still opened. I tried closing the original form and even the table but I still get the same problem. If I open the form without going through the button the update works. Does anyone know hoe to correct this problem?



Thanks in advance.

View 1 Replies View Related

Update Text Box From A Combo Box Using VBA

Apr 8, 2005

Hi All,



Thanks so much for your help in advance. I’m working on a Form1 that has a combo box with Row Source coming from a query Just like:



NAME ITEM_ID

Smith 10011

Smith 10012

Scott 10022

Clark 10015

Clark 10016



Now, I want to be able to update the Item_ID value to text boxes txt_SN1 and txt_SN2 once I click on the combo box and select the name “Smith” then show 10011 in txt_SN1 and 10012 in txt_SN2. I’m not sure if this can be done with record set or just with column values from the query.



Can someone help me with this problem? Your help will be highly appreciated.



Mosquetero

View 2 Replies View Related







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