Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

display two fields in item label menu

Posted 26 Jun 2002 17:02:47
1
has voted
26 Jun 2002 17:02:47 Dwayne Gandy posted:
Can anyone help me to display more than one database field in the item label selection of a record incert form? For example I want to select from a table of contacts. With only one field showing I don't know which of the 50 "smith's" I am looking for. I need a combination of First, Last, & Middle I.

Any suggestions?

Replies

Replied 26 Jun 2002 17:25:56
26 Jun 2002 17:25:56 aegis kleais replied:
I'm a bit confused as to what you want here. I'm not sure what you mean by ITEM LABEL SELECTION of a RECORD INSERT FORM.

But since you said you want to select from a TABLE of CONTACTS (you can't select from a table as that it's not a FORM element) And you state that with ONE FIELD showing (a field is from your recordset).

I'm going to make assumptions on what you want, but please expand on what you're trying to do so I can help more.

if you make a recordset with UD called rcdUsers, the following code works:

varFirstName = rcdUsers.Fields.Item("fldFirstName".value
varLastName = rcdUsers.Fields.Item("fldLastName".value
varMiddleInitial = rcdUsers.Fields.Item("fldMiddleInitial".value

Then if you want to display all 3 variables (each from their own field in your recordset) you could set a multiple selectbox with:

<select name="listOfUsers" size=3 multiple>
<option ="<%= varFirstName & " " & varMiddleInitial & " " & varLastName %>" value = "="<%= varFirstName & " " & varMiddleInitial & " " & varLastName %>">
</select>

--------

Of course, you'd have to use a dynamic population of the select box so that you can fill the other users of the table into the list.
Replied 26 Jun 2002 20:05:59
26 Jun 2002 20:05:59 Dwayne Gandy replied:
Sorry, Here's the scoop.
Using UD4 and MS Access, and ASP server format. Table in access of contacts has ,contact no, last name, first name, middle I, SSN#,,, etc. On a (ASP) record insertion page I would like to use the "drop down menu" feature to select the appropriate contact for insertion. The data inserted would actually be the "contact number". I have created a record set in the data bindings window for "contacts". The problem is first name, last name, and Middke I, are all separate items. The standard "list values" only allows me to select one of these items for "item label" and one "value". This means when I actually use the drop down list the only think I can see is either, the last, first or middle I. With only one of these I have no idea who I'm selecting.
What I want to do is create a way to show the Last name, First name and Middle I in the "item label".

Hope this is more helpful

Replied 26 Jun 2002 22:07:09
26 Jun 2002 22:07:09 aegis kleais replied:
Ok, if I understand this correctly, you want the following.

Example of data in DB (more so in your table called tblUsers)

first name | middle initial | last name | contact number
----------------------------------------------------------------------
John | C | Smith | 1.321.321.3210
Jerry | L | Smith | 1.123.123.1234

Make a recordset called rcdUserName.

This recordset's value should pull Firstname, MiddleInitial and Lastname from tblUsers, no filtering, no sorting.

Make another recordset called rcdContact

This recordset's value should pull Contact Info from tblUsers, no filtering, no sorting.
-----------------------------------------------------

On your page, insert a dropdown box. Press the LIST VALUES and in the first, enter the following handcoded (you will have to change it to suit your db names and all) into the LABEL.

<%=(rcdUserName.Fields.Item("Firstname".Value) & " " & (rcdUserName.Fields.Item("MiddleInitial".Value) & " " & (rcdUserName.Fields.Item("Lastname".Value)

Then click on the VALUE button and hit the DYNAMIC lightning bolt and do the following:

Select rcdContact, and select rcdContact.

Press OK.

THis should make a dropdown list with the following options in it:

John C Smith
Jerry L Smith

(But the VALUES of each, ie, document.all.selectboxname.value, will be their respective contact numbers) Is this what you wanted?
Replied 26 Jun 2002 22:08:37
26 Jun 2002 22:08:37 aegis kleais replied:
Dangit! I wish this forum had post editing!!!

Make sure you close off that LABEL asp code. with %>

The line should read:

<%=(rcdUserName.Fields.Item("Firstname".Value) & " " & (rcdUserName.Fields.Item("MiddleInitial".Value) & " " & (rcdUserName.Fields.Item("Lastname".Value)%>
Replied 27 Jun 2002 20:03:54
27 Jun 2002 20:03:54 Dwayne Gandy replied:
aegiskleais ,,, you are a genius! Worked like a charm. This opens a whole new realm of possibilities for my project.
Thanks!

Dwayne




Replied 27 Jun 2002 21:27:49
27 Jun 2002 21:27:49 aegis kleais replied:
Thanks for the compliment, but if I was a genius, I'd be employed by now. <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Glad it worked for you buddy; take care.

Reply to this topic