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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto fill a textbox after choosing a record in a combobox

Status
Not open for further replies.

Samulayo

Programmer
Aug 13, 2002
46
GB
Hello,

I have two tables (actually more but two in question)

one holds data about an operating system module (engineering not computer OS)
and the other the info about hazards on the OS

cut down view

Table1 Table2
OSNo----------<OSNo (one-many)
Desc Hazard

When filling out the hazard details form the OS is selected
When this is done i'd like the description textbox automatically filled with the OS description. This isn't required to be written to Table2, but if its easier this way, then no problems (it may also be useful in the future)

Thanks in advance for any help offered

Regards
Samulayo
 
Hi there,

You could base the form on a query e.g.

SELECT table2.OSNo, table1.Desc, Table2.hazard
FROM table1 INNER JOIN table2 ON table1.OSNo= table2.OSNo

In your form, you can bind a textbox to the desc field, and made the textbox locked and disabled.

Hope this helps,
Cheers,
Dan

 
Dan,

Thank you for your prompt reply, but unfortunately it did not work. I thought that it whould work, but it only works for just displaying old records, it cannot be used for adding new records or editting records.
The message &quot;This Recordset is not updatable&quot; is displayed on the message bar.

Thanks anyway.

Does anyone else have an idea for a solution to this problem.

Regards
Samulayo
 
Samulayo, when I get the &quot;record set not available&quot; message, it has always been because I didn't have a primary key defined in the table. Current data will display but new data cannot be added. Make sure you have a primary key.
drStealth

 
drStealth, Well spotted, I had forgotten to turn on the primary key. Note to everyone: just because something us obvious doesnt mean you wont get it wrong.

Thanks again drStealth

Regards
Samulayo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top