Forms :: How To Update Fields Based On List Box Selection
Apr 8, 2014
I'm building a customer form using a list box of summary customer info on the left side of the form (CustId and Names) and customer details on the right hand side. I want the details shown on the right to be those for the customer selected in the list box on the left. I'm having problems getting the details to update when a different record in the list box is selected or clicked.
I originally set the data source for the detail records to the base customer table but couldn't work out how to update them when the list box was clicked!
I then tried creating a query with the select clause conditional on the list box (CustId = Me.qryContactDetails) and set the data control source for the detail record to the query (=[qryContactDetails]![FirstName]). The query works as expected but the field in the form just shows '#Name?'.
I tried adding a field requery on the List31_Click() event using Me.[FieldName].ReQuery but that didn't seem to change anything
I have a form whereby a user for my database can be created. The fields required are listed below:
Payroll ID Forename Surname Location Manager
The last two fields are related to two other tables; tblLocation and tblManager, which are related to one another.Each location (there are three) can have more than one manager, however, a manager can be associated with only one location.I would like whomever is creating the user to only be able to select a Manager that works at a particular location, currently, I can select LocationID 1 and ManagerID 3, but ManagerID 3 works at LocationID 2.
How can I base the 'Manager' field in my form on the previous field's selection, e.g. 'Location'.Also would need to restrict the order in which the form's fields are enter, i.e., 'Location' before 'Manager'.
I have a Customers table and an Orders table. My Customers table is a bit different than the norm because I couldn't figure out any other way to do this.
My client's customers are either businesses (companies) with a contact person, or individual customers. So, in the Customers table, I have the following fields (there are others but do not apply to my problem):
Customer ID Company Contact Customer
So, if it is a company the data entry person would enter the company name and the full name (EX: Doe, John) in the contact field, but if it is an individual customer, then they would leave Company and Contact blank and enter just the Customer name (Ex: Doe, Jane).
So, in the Orders table, I have combo boxes for look ups for the fields Company and Customer.
That works okay, but I would really like for the Customer ID to post into a text box once the Company or Customer has been selected. In other words, the input person would enter the name, then it would show that Customer's ID #.
I am designing a nomination form (web database so no vba macros can be used).
The form has 3 combo boxes: cboStaffName, cboLevel, cboNominee.
The form is bound to the tblSubmit table where the submissions are populated.
I used a select statement:SELECT Staff_List.Staff_Name FROM Staff_List; to populate the combo box for the Staff Name selection.
This is the select statement to populate the job level combobox:
SELECT Staff_List.Level, Staff_List.Staff_Name FROM Staff_List WHERE (((Staff_List.Staff_Name)=[forms]![frmtest]![cboStaffName]));
The select statement to populate the combobox for the nominee combobox:
SELECT Staff_List.Staff_Name FROM Staff_List WHERE (((Staff_List.Level)=[forms]![frmtest]![cboLevel]));
The problem is that the staff_name in the first combobox is still found in the nominee combobox which should not be because a staff cannot nominate self. There is a field in the Staff_List called YesNo that should be activated for each staff that is selected so that the select statement on the nominee combobox can be updated accordingly to remove items with the field "Active"
How to get the checkbox selected for each corresponding staff.
I have a form that contains a list box with 11 separate options. Within this list is the option named "None". My desire is to have a message box displayed when any option is selected other than "None". I have searched various threads, however I have been unsucessful nailing down my issue. Thanks in advance for the assistance.
how to Add/Update record including existence of record based on single unique field.Now I trying to learn how to check existence of record on multiple field before adding (at least two) and how to update the record with multiple field record
Below is my testing table fields
Year Month Working Days 2013 Jan 20 2013 Feb 17 2013 Mar 22
Now two situations adding a new record and updating the existing record Which means the unique fields are (Year + Month)
Dear all, is it possible to run a query (or ideally a report) based on a selection from a drop down list in a form? (in accsess 97). The reson being is i have a big list of of codes for different absence reasons & at present the user has to type in the correct code to display the data in a report based on the code they enter, however its not easy for users to remember which code to type in to run a report.
Idealy what i would like is a drop down list with the absence codes & the absence desciption next to each code, then when the user selects a code from the list it displays the corresponding data in the report?
Is this possible?, any help would be much appreciated, thanks.
I have a query that allows the user to put in a date range - this works.He also wants to limit what he prints.
For example at the moment he gets
OrderA rest of line 1 for orderA OrderA rest of line 2 for orderA OrderA rest of line 3 for orderA OrderB rest of line 1 for orderB OrderC rest of line 1 for orderC OrderC rest of line 2 for orderC OrderD rest of line 1 for orderD . . .OrderZ etc
He only wants to say print lines for OrderA and OrderD. It's he's choice and not based on anything else already in the table.
I see that in the criteria on the design for the query it allows me to bbuild an expression and I can select a list box on the form such as
[Forms]![name of form where list box is]![name of list box].[EXPRESSION VALUES]
I don't know which expression value to choose. I have tried afterupdate and beforeupdate but none of the rest look like they are the ones I should be using.
Upon the results which populate my list box what I am trying to do is allow the user to select various values from the list box and then hit a button which deletes the values from the table. My code is currently:
Code: Private Sub Del_TsCorrection_tbox_Click() Dim lngID As Long Dim strSQL As String
[code]...
But it doesn't delete, infact it doesn't do anything. The list box values are still in the list box and if I look in the table they are still there also.
When creating a query I have set up a parameter query as instructed (in this case searching for a name) but when I run the query it returns the error 'this expression is typed incorrectly etc.'
I have worked out that this must be due to the fact that the names are not typed in by a front-end user but need to be chosen from a dropdown list (which i have stored in a separate table) - So, the query seems to fail based on that.
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")
I am trying to build a form in the MoldReq section so when the user selects the mold number(combo box) it will auto populate the Part_Name and Part_No fields by pulling the data from the Molds table.
I have tried following this video where I create a change event:
Code: Private Sub cboCombo31_Change() Me.txtPart_Name.Value = Me.cboMold_No.Column(3) Me.txtPart_No.Value = Me.cboMold_No.Column(4) End Sub
Is it possible to add a field (i.e., variable) to a query (or SQL programming) based on a form selection?For instance, if I use a form to allow an end-user to specify which fields they wish to include in the query (essentially creating a UI for the query builder), how would I go about creating the query/SQL or updating the query/SQL?
I have a table (ComponentT) of different device components a user can select from ( generators, gearboxes, etc.)
The table has 3 fields - ComponentName, ComponentType, ComponenentDetails
I have a query returning all the ComponentDetails values.
I then have a combobox that uses this query as a row source.
The user can select different components they want from the combobox. Once something is selected, it is added to a new table - UserSelectedComponentsT
As a device can have only one gearbox or one generator etc. I want a warning messagebox to be displayed if the user tries to select a generator from the combobox when one has been previously selected.
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.
I don't have any database experience whatsoever so please go easy. I'm guessing this kind of this is extremely simple for all of you.
I'm constructing a database of network resources and devices and I'd like to automatically update the values in one field based on the values of a field in another table.
The first table is called "IP" and the fields are called "Address", "IP Type" and "Device". The second table is called "Devices" and contains the fields "Name", "Description", "Asset Number" and "IP".
Here's an example of the tables: (ignore the "code" tag. i've only used it to align my columns properly)
What I want is for the Device field in the IP table to automatically update it's values based on the values found in the Devices table. In this case, the values that should appear in the Device field in the IP table are "Xserve" and "ProliantX".
I've searched through but haven't found a complete solution, just little pieces which I'm too inexperienced to put together myself.
I've been working on this application for a long time, and my combo box always behaved well before, but today I click on the combo box, the list drops down, but I can't select anything. I've also tried typing the item on the list into the combo, which normally works, but I'm not being allowed to type anything there.
I have a list box, List3, in a form, which is populated from a query. The list populates correctly.I added a command button which I want to open a new edit form with the selected record from the List3 control.I used this code on the DoubleClick event - it opens the form EditEquipment, but the form does not have the relevant record, ItemID, open in it. It's an autonumber field and primary key. Is there something I now need to do in the EditEquipment OnLoad event or something like that?
Private Sub Command5_DblClick(Cancel As Integer) If Len(Me.List3 & "") > 0 Then DoCmd.OpenForm "EditEquipment", acNormal, , _ "[ItemID] = '" & Me.List3 & "'" End If End Sub
i want to see the product image in my database as per my selection from listbox in "frm_MainForm" but it shows error no 2220. database file is attached.
It does show the image when i add it to the form "frm_PruductMaster" and search in "frm_MainForm" but only until i restart application. after restarting application it again shows error 2220. But it shows image name in the error. (i have tried with .bmp and .jpg as well).
I am trying to resolve a problem with selecting multiple records.
I have a table called T_user and bound form called F_user.
This form displays all 3 fields from that table.
When I want to add a new user, I enter a name and select a department.
Some of the users work for few departments, so here is the question:
How to select multiple departments for one user?
The department field in F_user is set to LISTBOX, and the multi select option in properties is set to SIMPLE.
I can select multiple departments, but as we know it won't save in the table, it will leave it as NULL value.
How can I save the record then? In another form I need to select users from specific department, so lets say A.Smith, need to be visible in those few selected ones.
I've created a database to track training courses. I'm having issues with selecting multiple trainers. I set up my table to lookup a "List" on the trainer column. I've entered 2 records into my form and it displays 6 records. See attach image.
I've been using this forum for a couple of weeks but this is my first post, so apologies if I've put it in the wrong place!! I have a table with some drop-down lists to fill certain fields, and I would the available list options to change based on information in other fields. To provide an example:
Field One: The drop down list lets the user choose "Alphabet" or "Number"
Field Two: The drop down list lets the user choose A-Z if "Alphabet" is selected in Field One or 1-100 if "Number" is selected in Field One
Hope I've been clear enough. Any help is greatly appreciated!!
I inquired on this original thread [URL] .... to hide/show fields based on two Yes/No dropdowns.
Summary: 1. If "OtherUnivEmployeesInvolved" = "Yes": The fields "OtherUnivEmployeeFullName1" "OtherUnivEmployeeFullName2" "OtherUnivEmployeeFullName3" are shown.
If "OtherUnivEmployeesInvolved" = "No": These 3 fields are hidden.
2. If "OutsideRepresentVendor" = "Yes": The fields "OutsideIndividualLastName" "OutsideIndividualFirstName" "OutsideIndividualCompanyName" "OutsideCompanyStreetAddress" "OutsideCompanyCity" "OutsideCompanyState" "OutsideCompanyZip" are shown.
If "OutsideRepresentVendor" = "No": These 7 fields are hidden.
I have this basic validation code when a user hits the save button:
Code: Private Sub Form_BeforeUpdate(Cancel As Integer) Dim ctrl As Control For Each ctrl In Me.Controls If ctrl.Tag <> "skip" Then
[Code] .....
Within "1." - If yes is selected, I only need "OtherUnivEmployeeFullName1" required.
Usually skipping FullName2 and FullName3 would be easy using the ctrl.tag "skip" but I am already using the control to show hide these fields so how to do that.
Within "2." - If yes is selected, I need all 7 fields required.
So I need to figure out how to require fields based on those Yes/No selections because right now the form is checking every field regardless of the yes/no selections. I would also need to skip "OtherUnivEmployeeFullName2" and "OtherUnivEmployeeFullName3" everytime.
I am using this code to filter a List Box based on a Date range and a Combo Box selection:
Code: Private Sub Combo139_AfterUpdate() Dim StrgSQL As String StrgSQL = "SELECT [User Name], [Date Of Request], [Description of Problem], Status, Sub_Job FROM QRY_SearchAll " & _ "WHERE [Date of request] BETWEEN #" & CDate(Me.txtStartDate) & _ "# AND #" & CDate(Me.txtEndDate) & "#;" StrgSQL = StrgSQL & " WHERE Sub_Job = Combo139" Me.SearchResults.RowSource = StrgSQL Me.SearchResults.Requery End Sub
However, It is not working. when I click the Combo box the List Box comes up blank.