Combo box with 2 columns filled by value list


I am trying to create a combobox with two columns (the second hidden) from a ValueList with the second column being the bound column.

My problem is that I cannot get the combo list to return the second column.

ColumnCount = 2
ColumnWidths = 2cm;0
RowSource Type = Value List
Bound Column = 2
Row Source = John Smith; "john.smith@hotmail.com";Jim Hill;"jim.hill@hotmail.com";Jack High;"jack.high@hotmail.com"

as far as I thought ME.mycbobox.value should return the email address being the second column


Sponsored Links:



I have a combo box with 2 columns "Customer code" and "Customer name", the "Customer code" is the bound column. 1. How can I show the value of the "Customer name" on a separate text box.
2. This combo box is used as a data entry for the new "sales", how can I validate the "Customer name" in a "tbl_sales" by just choosing the "Customer Code" from the combo box.




Probably fairly easy but have been searching online with no luck

For every type of equipment there is many questions that I would like to display when selected


I have created a combo box with multiple values from 2 different tables with the following values

tblQuestions.EquipTypeID, tblEquipmentType.EquipTypeName, tblQuestions.QuestionID

however I want to sort the values so that the combo only displays one selection for each equipment type

The following SQL statement gives a different instance for each question

SELECT tblQuestions.EquipTypeID, tblEquipmentType.EquipTypeName, tblQuestions.QuestionID
FROM tblQuestions INNER JOIN tblEquipmentType ON tblQuestions.EquipTypeID = tblEquipmentType.EquipTypeID;

AS Does this one as all rows are unique it is the equipment type that is the same

SELECT DISTINCT tblQuestions.EquipTypeID, tblEquipmentType.EquipTypeName, tblQuestions.QuestionID
FROM tblQuestions INNER JOIN tblEquipmentType ON tblQuestions.EquipTypeID = tblEquipmentType.EquipTypeID;

I think I may be able to use GROUP BY but nothing that I implement seems to work and have searched far and wide

GROUP BY (tblQuestions.EquipTypeID, tblEquipmentType.EquipTypeName, tblQuestions.QuestionID)


Thanks




i have a combo box reading in two fields from a table - id and name. Is it possible to have "autofill" pick up the name but when i make my selection, the id becomes selected.

i.e. if i have these:
ID NAME
1 Pete
2 Dave
3 Alan

and i type in "Dav" and press enter, the value in the combo box will be the id "2".

thanks




Hi

I have a combo box with 2 columns, one for an index (code), one for a name. When a value is selected, only the index is displayed.

I'm trying to find a way to display the name in a text box (or anything else) so that the name is visible.

I've tried for days already! Please help if you can!!!




i would like to make a combo box with 2 columns. the first will be the comapny name the second the account number. i have the account number stored as a series of numbers, but i alway shave it displayed as 12-9008 with the input mask. however, when i try to use the input mask for the combo box, it doesn't display it that way. any suggestions?




On my form i have a list which takes information from a table. I have set column headers to "on". What i want to do is populate my combo box with the column heads in my list box. Anyone have any ideas?

Cheers,
Matt




Hi,

I've created a combo box called Purpose_combo in Access. I populate this combo box with a list of values (such as "Response";"Reply"; "Advice")that are not generated from an SQL query. I only get its indexed number instead of the string when I use debug.print Purpose_Combo, such as I have got 1 for Response, 2 for Reply, 3 for Advice. When I use this value as a conditional statement in a sql query (such as, select * from table where table.Purpose like "'" & Purpose_Combo & "'"), the query doesn't work. The data type of table.Purpose is text.

I have tried it using Purpose_Combo.Column(1). However, it is only working in the VBA program, not in SQL query. When I put Purpose_Combo.Column(1) in the query and ran it, an error message is displayed saying that "Undefined function Column() in expression" . I think that Column() function is not recognized by SQL.

I have also tried to use Decode () in the query, such as select * from table where table.Purpuose like Decode(Purpose_Combo, 1, 'Response', 2, 'Reply', 3, 'Advice', ''), but I got the same error as using Purpose_Combo.Column(1).

Does anyone know how to solve this problem? Thanks in advance.



vicgirl




Hi there.

I've been having trouble with this all day and I was hoping someone could help. Here is what I am trying to do:

1) The user selects a value from a combo box. This combo box has 2 columns. The first column is a username and the second column is that user's initials. The only visible column is the username column.

2) Upon selecting a user from the combo box, the list box is updated to show a list of files written by that user. The naming convention for all files in the system is user initials followed by a date (ie. AB141003.ext).

3) The user highlights a file or files in the list box that belong to the user selected in the combo box and then presses a button to open them.

So far I have been able to get files to open by hard-coding in a value for the initials. The problem is that I can't seem to get the initials to change when the combo box changes so that I can get a new list of files for another user.

Here is the code for what I have done so far. I've purposely left out the code to open files that are highlighted in the list box to save space and b/c I know it works.

------------------------------------------------------------------------------
Option Compare Database

Dim username As String
Dim userabbrev As String

Private Sub combo_box_user_AfterUpdate()

Me.combo_box_user.SetFocus

username = Me.combo_box_user.Column(0)
userabbrev = Me.combo_box_user.Column(1)

End Sub



Private Sub Form_Open(Cancel As Integer)

Dim file_array()
Dim file_search As Object
Dim i As Integer

Me.combo_box_user.SetFocus

'The following section is hard-coded b/c setting username and
'userabbrev = Me.combo_box_user.Column(x) causes an error

username = "Al Jones"
userabbrev = "AJ"

' Declare file search objects
Set file_search = Application.FileSearch

' Set the folder to search.
file_search.LookIn = "C:Documents"

' Set file name to search for.
file_search.FileName = userabbrev + "*.*"

' Execute the file search, and check to see if the file(s) are present.
If file_search.Execute > 0 Then

' Redimension the array to the number of files found.
ReDim file_array(file_search.foundfiles.Count)

' Loop through all found file names and fill the array.
For i = 1 To file_search.foundfiles.Count
file_array(i) = file_search.foundfiles(i)
Next i
End If

' Loop through the array and fill the list box
If file_search.foundfiles.Count >= 1 Then
Me.List0.RowSource = file_array(1)
For i = 2 To file_search.foundfiles.Count
Me.List0.RowSource = Me.List0.RowSource & ";" & file_array(i)
Next i
Else
Me.List0.RowSource = "Documents not found for user: " + username
End If

End Sub


What this all boils down to is filtering the filenames. This is probably something really easy to do, but I'm new to Access and that is why I am having difficulty.

Thanks to anyone willing to help.




OK my brain has died. I know this should be child's play or something obvious to search for but I'm drawing a blank.

I have a combo box bound to a table with two columns, an ID and a companyname.

When I ask for me.cmbcombobox.value I get the ID, what I really want is the company name information.

Whats the syntax, pretty please




Access 2007. Got a form with a few combo boxes containing options. Each option concerns a First and Last Name. In the list, they show up as this:

John | Doe

But when I pick an option, only the John shows up. The same goes for my, or what is supposed to be my zip code + city combo box.

Is there a way to show the 2 fields in the same box, separated by a space? Or if I need a second field showing the second one, how does that work?




I am working on a report to print a list of all the products in my DB with the unit prices, essentially a price list. The report is split into two columns via the pagesetup and is grouped by the field ProductType.

I would like to draw a single distinct vertical line between the two columns, I have tried using the Line method in the OnPrint event of the detail section. However this method results in 2 lines as there are 2 columns in that section.

I am currently trying to use the Line method in the Page event of the report instead. However since the line method uses the X & Y coordinates from the first page only which has a larger pageheader unlike the rest of the pages, the line draws correctly only for the first page but is too short for the rest of the pages.

Private Sub Report_Page()
Dim X1 As Single, Y1 As Single, X2 As Single, Y2 As Single
Dim col As Long

Me.DrawStyle = 0
Me.DrawWidth = 25

X1 = 5095
Y1 = (Me.PageHeaderSection.Height + Me.ReportHeader.Height)
X2 = X1

col = RGB(35, 115, 93)
Y2 = Me.ScaleHeight - (Me.PageFooterSection.Height + 100)

Me.Line (X1, Y1)-(X2, Y2), col
End Sub

Would appreciate any help or advice on this issue, Thanks




Hi everyone,

Some of you may have seen the problem already. To make the questions more clearly, I have attached the db file.

Basically, in this database, I have three tables.

Maintable includes several fields, such as ID (primary key), Name, Date, [Sent To 1], [Other Sent To], [Purpose], Topic1, OtherTopic.

I also have SentCopiedTo table including ID (primary key) and ReferName, and Topics Table including ID (primary key) and Topic.

The [Sent To 1] field in the MainTable refer to the SentCopiedTo table, and the Topic1 field refer to Topics Table.



I also have two forms - Entryform and SearchForm. EntryForm shows all the detail of the record in MainTable(one of the tables) and also can insert the new record. SearchForm shows the list of results matching the search criteria which containing Name, Date Range, and etc. The qry_search_Form query is the one to search the result for the searchForm.



My problems with this database are:

1. Entryform and SearchForm, which are independ to each other. An empty record has to be inserted when EntryForm is opened. When the results are listed in the SearchForm, I set that its open its corresponding record in the EntryForm when clicking one of the Id in the list. However, it shows an empty record instead of the record with the ID. I have to click




Hello,
I have a Combo box with 2 values, Shipper and Receiver. How to create a query, macro or code, when I choose specific value, in my case Shipper, I want to open specific form, or something else...

thank you to everyone in advance for help




I have a combo box with multiple columns which are: (UsergroupID;UserGroupName;Password) Currently only two usergroups are used, "administrator" and "admissions tutor". These reside in TblSecurity

Columns 0 and 2 are hidden, and column 1 is used to select a user name. This works fine for the first time of logging in, however after logging in I've noticed something peculiar.

After logging in the "Administrator" usergroupName in tblSecurity changes to either "1" or "2". So then if I try to log in again my combo box gives me the option of choosing "1/2" or "Admissions Tutor".

If I login as an administrator, the administrator record changes it's name to "1"
If I login as an Admissions Tutor, the administrator record changes it's name to "2".

Any Ideas?




Hello everyone...

I have a database where I am using a combo box with 3 columns. It has a total of 3 rows. The reason for the 3 columns is I have a term that is translated in English, Vietnamese, Spanish.

For example:
English text in Column 1 = Yes
Spanish text in Column 2 = Si
Vietnamese text in Column 3 = Phải

...I am placing the combo box on my form.

In my main table I have fields for English, Vietnamese, Spanish.

Essentially - what I want it to do - is to populate the English, Vietnamese, Spanish fields based on my selection on the combobox.

Do I make sense...?

So...if I choose yes...I want it to populate Yes, Si and Phải in my main table.




Hi
I'm new user converting over from Lotus Approach. I'm using Access 2013.
I have a database with two tables being Suppliers and Products. This is a one to many type database with Suppliers being the one table.
Both tables have their own data entry forms.
In the Products table and data entry form is field named Category with a value list of about 20 different values.
The query I need to create is to search on the field value from one of the listed values in the associated combo box.
I have set up the basic query using the Query wizard. To run This I have to entry the value I wish to search for in the Query in Design mode.
My problem is now I want to drive the query from a new form.
On the new form I have created a combo box where the field list is the same as on the product data entry form.

I need to use this combo box to select the Category field value I need to search for and then click on the button to run the query. I seem to be stuck on the SQL code to achieve this
Any help or guidance much appreciated
Swingtones




I am working with MS ACCESS 2000.

I want to display a combo box in a form which will display the column names of a particular table. I know that I can set the combo's RowSourceType to Field List and then set the RowSource to the table I want to display the fields for.

Now, if I want only the date fields to be displayed (ie the columns of the table which have Date/Time as their Data Type) in the combo-box, how can I get this done..? Is there any way I can filter out all the other columns?




I Have a combo box i want to list a name in one column and a number in the other

I want the number to transfer from the combo box to another field that i figured out fine. but how do i get the first column with the name to save to a certain table?

thank you for the help




Hey All - I have a combo box that reads from a table and has 4 columns. The name of the contractor, phone 1, phone 2 and fax. When you select a contractor the phone and fax numbers show up in their own text box. I also have a notinlist command that allows the user to add a new contractor.

The problem how do they add the phone and fax numbers for the new entry?

Thanks!
~Amelia