Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems displaying a memo field on form. 1

Status
Not open for further replies.

mmaglio

Programmer
Jun 20, 2003
28
JP
Hi everyone;

I want a text box to display the description of a vendor when I choose that vendor from a list box.
The list box (listVendor) does not show all the vendors in the database. The contents of this list are narrowed by the choice in another list box on the form.
The table 'VendID' has the names of all the vendors (Vendor)(which is the primary key in the table) as well as a description field(Description) and other information which is not important here.
As the user highlights different vendors in the listbox I would like the description field to appear in the text box (the description field is a memo type).
I have been trying to code the listVendor AfterUpdate event to send the description into the text box, without success.
I have been toying with this line of code, because it is similar to the one I am currently using to update the RowSource of listboxes from other listboxes.
Me![Text23] = "Select [Description] FROM [VendID] WHERE [Vendor] = '" & Me![ListVendor] & "'"
I'm not too hot at the VB coding, but this might be close.


Any Ideas? Thanks for the help.

Mark
 
An easier way to do this might be to use a listbox instead of a textbox and in the rowsource property create a SQL statement that looks to the vendor listbox in the Where clause. Here is an example I use for filtering a combobox that displays school names.
Code:
SELECT School_LKP.SchoolName FROM School_LKP WHERE (((School_LKP.Accredited)=Abs([Forms]![AddSchool_subform]![radAccredited])) AND ((School_LKP.ForeignSchool)=Abs([Forms]![AddSchool_subform]![radforeign]))) ORDER BY School_LKP.SchoolName;
Then in the AfterUpdate event of the vendor listbox you need to requery the description
Code:
SchoolName.Requery
Hope this helps!
 
Thanks Orion,
Its worth a shot; I'll try it right now. I guess for some reason I thought a list box wouldnt take memo type fields. I'll see how it goes.


 
It works! only problem is that the words flow off the side of the listbox... know any way to solve this. Im not seeing any property to make them wrap back around.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top