Forms :: Adding Key Value Pair In Combo Box Using RowSourceType As Value List
Jun 20, 2013
I am creating a form in access. In the form there is a combobox in which I am adding items using RowSourceType as Value list and Row Source as Male;Female. What I require is whether there is some way so that when I select Male from combo box M is stored in database and with Female F is stored. I know how to achieve this with RowSourceType as Table/Query but not with RowSourceType as Value List.
Does anyone know of a way to allow a user to add further info to another field on the same record that's created by a combo box that is using the Not In List method?
Dim strsql As String Dim i As Integer Dim Msg As String
'Exit this sub if the combo box is cleared If NewData = "" Then Exit Sub
Msg = "'" & NewData & "' is not in the list of Callers names." & vbCr & vbCr Msg = Msg & "Do you want to add it?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Caller...") If i = vbYes Then strsql = "Insert Into tblCallersName([CallersName]) values ('" & NewData & "')" CurrentDb.Execute strsql, dbFailOnError Response = acDataErrAdded Else Response = acDataErrContinue End If
I need to log a persons name & phone number without having to re enter it again the next time.
To log the name I use a combo box that lists all the previously added names & it also allows you to add further details if the name does not already exist
I now need to work out how to also add the phone number without having to manually go into the names table to add it in.
If anyone understands what I'm talking about then you're halfway there :D
I have a table DISCREPANCY_LIST..This table includes:
DATE (Auto completes to current date) EMPLOYEE_ID (Primary Key) (Brought over from Employee_Listing via form when initials are entered on form) LAST_NAME (Brought over from Employee_Listing via form when initials are entered on form) FIRST_NAME (Brought over from Employee_Listing via form when initials are entered on form) INITIALS DEPARTMENT NUMBER_OF_UNITS NUMBER_OF_DESCREPANCIES NUMBER_OF_OK_UNITS
I have a form - DISCREPANCY_LIST..This form enters information into the DISCREPANCY_LIST table.The initials combo box is set: Limit to List Yes and Allow Value List Edits No If the user enters initials that are not stored in the Employee_Listing table they receive an error. Instead of an error I would like for them to receive a message asking if they would like to add these initials to the Employee_Listing table.If the user clicks Yes, then it will bring up the Employee_Listing form.If the user clicks No, then they are told to enter valid initials.
I have a list box on a form and I would like the user to have the possibility to add another item not from the list into the table using a command button. How can I do that?
I have a combo box that is not tied to any control but uses a value list as the row source in the data tab. My question is... it currently holds two names but I am wanting to add a third but when I do the third name does not appear like the first two in the form view. The first two show:
Last Name, First Name, employee #
And the third shows Last Name, First Name
employee #
And on the third entry... the first name shows where the employee # should be
error message I am getting when I click on my Duplicate Record button (created through the wizard).
I have two combo boxes on the main form that populates data when the user makes a selection from the combo box. First combo box populates project data and the second combo box populates equipment data. The form is working well with the two combo boxes populating the data into the main table.
Now I would like to add a duplicate record button to copy a record and paste the data as a new record. So, I added a duplicate record button using the wizard and I am receiving the following AfterUpdate error.
Run-time error 3020: Update or CancelUpdate without AddNew or Edit.
This is the code I am using to copy and paste a duplicate record:
Private Sub InputForm_DupRec_Button_Click() On Error GoTo Err_InputForm_DupRec_Click DoCmd.RunCommand acCmdSelectRecord DoCmd.RunCommand acCmdSaveRecord DoCmd.RunCommand acCmdCopy DoCmd.RunCommand acCmdPasteAppend Exit_InputForm_DupRec_Click: Exit Sub Err_InputForm_DupRec_Click: MsgBox Err.Description Resume Exit_InputForm_DupRec_Click
It seems to be duplicating the data from the first combo box, but not the second one where it errors out.
I am trying to avoid to use a Combo Box & a List Box because of the way the records are stored in the table, I only need to verify that the user does not enter a 3 letter code that is not contained in a specific table (I have a table of countries with the 3 letter code example if the user types ESC instead of ESP an error appears) Is it possible to use the after update to verify the contents against a table?
I have a combo box on a form which has a row source type of Value List in which I've manually typed in 2 entries: Owned, Leased.
I have a query which filters on the results of the combobox, and works fine for when I select either option Owned or Leased.
Is there an easy way to filter all (both Owned & Leased)? I've tried leaving the combobox blank, and tried entering a * in the value list, but they both return no results.
Code:
SELECT Assets.* FROM Assets WHERE (((Assets.Possession)=[Forms]![Home]![Combo56]));
Is there a way to make a popup list open on click of a button (cmdAssign) and the user chooses/selects something from the list, then the popup closes and the textbox (txtAssignmentNo) is filled with the choice?
I am using a sequence of combo boxes on a 'Continuous' form.
To reduce the possibility of error I am using a 'Value List' combo box where I use AddItem method to add the previously entered string to the combo control so that it is there for use when entering the next record.
This works fine - but what I want to ask is - how to have a routine to check that the string does not already exist in the combo box before I AddItem i.e., I don't want duplicated values in the list.....
I have a list box and a combo box on a form based on a query. The list box is a multi-select, with column values of Client, ClientEmail, and Medical.
Medical is a simple yes/no field, and it is what I want the combo box to sort by. I have a Where clause in the query: WHERE (Medical=[forms]![frmOne]![cmbbx]), and the only values in the combo box are Yes and No (1 column). I also have the combo box set to run a requery macro after updating. I've also tried to change the macro to VBA:
Code: DoCmd.Requery "lstbx"
When I pick a string from the combo box, the list box just goes blank, rather than updating to clients who either do or don't have Medical, and I can't understand why.
I am adding a combo box to a form with data sourced from a table. Everything seems ok but when I select an option from the combo list and move to the next record the selection is repeated there also. How do I get to select a different option in the next record?
My form has a combo box which is bound to a query that selects a list of member numbers. The value selected the goes onto filter a list driven by an SQL statement.
Code: Private Function PopulateADO(qpMemberNo As Long) Dim cnn As ADODB.Connection Dim rst As ADODB.Recordset Set cnn = CurrentProject.Connection Set rst = New ADODB.Recordset
[Code] .....
This works fine when a single member is selected from the combo. But obviously i want a "select all" or * wildcard option.
Question is 2 parts. 1. How do i add the all or wildcard option to the bound combo? 2. How do i code the all or wildcard option into the SQL statement? Is it something like is not null ?
I want to add a combo box to a form, where depending on the values entered in the box another combo box would show more values. In other words, if the first combobox had choices of 1, 2, 3 and 4, if 1 was selected the next combo box would have values a, b, c and d. If 2 was selected, it would have values of a, d, e, f and g.
I am using the following code in a textbox (CountryID) to show a country name (CoName) from a table (tblCountry). If the comboBox (cmbCoName) in current form (frmCountry) has no entry then CountryID remains blank, great. If I use the form to add a new entry then CountryID flashes because it does not recognize the entry. Can I use "or" to add another condition in the IIF statement so that it allows the "not in the combobox list" entry?
Code: SELECT tblTrainingType.TypeID, tblTrainingType.Type FROM tblTrainingType ORDER BY tblTrainingType.Type;
My second combo (the one that should be filtered based on the Type chosen above) is cmb_Project_Title. The sql I have written (which isn't working) is:
Code: SELECT tblCourseDetails.CDID, tblCourseDetails.Project_Title FROM tblCourseDetails WHERE (((tblCourseDetails.TypeID)=Forms!frmResourcing.cmb_Training_Type) And ((tblCourseDetails.Type)=Forms!frmResourcing.cmb_Training_Type)) ORDER BY tblCourseDetails.[Project_Title];
Both of the tables that are referenced have the fields TypeID and Type.
On my Class form when assigning students there is a combo box which shows the students names. Once a student is picked in the combo box their name shows up in the subform.
What I would like is a way to NOT show a student in the combo box after they have been selected. Is this possible? Or should I be looking at another way of doing this?
Is it possible to remove an list item from a combo box list after it has been used.
What I am trying to do is use a combo box that has a list of questions, after the user selects a question from the combo box list and answers the question when they reselect the combo box that question will not be seen again till the form is reloaded.
I have a working combo box on a form that displays issue numbers for part number typed into a text box.This all works fine when the list of issue numbers is below the displayed list (16), but when the list is longer than 16 you cannot seem to select anything after item 16.
When the combo box has, say 25 items a scroll bar appears allowing the user to scroll down to item 25, but when you click the mouse the list just reverts back to the first 16 items? The only way to select an item after 16 is to select item 16 which then closes the combo box, then when you reopen it the list now shows items 17 to 25 which you can then select item 25.
This is the same in reverse, when you have item 25 selected, you cannot select item 1. When you click the mouse the list reverts back to items 17 - 25.The combo box is populated in code using the lost focus event on the text box for the part number.
I have a chart I am trying to create that pulls data from a table. It pulls from a list of about 7 items. The issue I have is when I do this it is showing the ID numbers in the legend and not the actual names>
During the course of it's development I have created about twenty tables whose sole purpose is to house data for use in combo and list boxes. They have no other purpose.
I am now in the process of creating the maintenance side of this project and how to manage these lists. In the past I have created a form with a multitude of subforms to manage these lists.
On my unbound form I have a combo box with a record source type set to value list and the record source with two choices in it. I would like the combo box to reset back to either blank or a the phrase "select one" once a record is saved. If it shows "select one" I do not want the user to be able to actually select that. As I said the form is an unbound form and I have used the coding of "insert into" to save the new record to a table. I have been able to clear the text box on this form when the new record is save by resetting it's value to "" but have been unable to reset the combo box to blank.
how do I reset the combo box through code after a save to display nothing - or is there a way to add a non-selectable choice to the list and have it display when the form is refreshed.
I want to add a conditional formatting to a combo box to highlight if the value is not on the list.There is a process to read in data from a 3rd party excel sheet that has truck arrival dates and times. My form displays this data and allows the internal users to change it. My form has the "Trucks" field as a limit to list combo box - so basically any data can be read into this field but internal we can only change it to trucks on the list (from the trucks table). I want to highlight where the trucks value is not in our trucks list.