On Tue, 7 Aug 2001 22:33:03 +0100, "Dollar"
Quote:
>Hi, I am new to VBA, and all help is much appreciated.
>I am trying to write a program on a form that will when a ProductID is
>entered will retrieve ProductName from another table, and put it onto the
>form. I have tried to use the DLookup procedure, but it does not seem to be
>working.
Hm. Ordinarily no VBA code whatsoever is needed. If you have the
ProductID as a field on your Form's recordsource, the simplest way to
display the product name while storing the ID (which ordinarily should
be unseen) is to use a Combo Box control based on the Products table.
Make the ProductID the bound field and the Control Source, and the
product name the first (or only) non-zero width field. The Toolbar
Combo Box wizard will help you set this up.
Or, you can base the Form on a Query joining the Product table to your
current recordsource, and pick up the product name from the joined
table.
John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public