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!

DBGrid Lookup field problems

Status
Not open for further replies.

bobstery

Programmer
Aug 18, 2003
4
GB
I am trying to insert a row to a database using a dbgrid. I have four lookup fields, each one relating to a different table. However when I access a lookup fields drop down menu and select an item I get the following error message:

Project name.exe raised exception EOleException with message 'An unknown error has occurred', Process stopped. Use step or run to continue.

This message appears everytime after enetering a value until data is present in each of the lookup fields. So if I try to insert a value in a lookup field and there is none present in the other 3, 3 error messages will appear after pressing F9 after each message.

Why do I get this message as the lookup fields are retrieving data from different tables?

 
Hi,
You are not using BDE, right? Well, you did not say what you are using lookup-fields for. If you could give a more detailed description it would be much better, but it seems to me that those error-messages are to be expected, since you are trying to (obviously) post record to table without all the required fields being there :)
 
I get the error messages before posting i.e. when entering a value into any field and then tabbing, causes the error(s) depending on which lookup fields have a value.

I am using the lookup fields so that the user doesn't see the code reference, but a more friendly representation of what is wanted e.g. I show the owner's name in the DBGrid using a lookup field, I store the reference however in the table e.g. 001. In the owners table 001 has a name of Brian. Therefore when entering a new value using the DBGrid I want to show the names rather than the codeRef, therefore I use a lookup field which automatically genrates the right value for the code.

I do this for another four fields, that each correspond to a different table. So why do I get the error messages if I am not posting the data. After each error message appears I can go on and post the data into the table, with no errors, however I don't want error messages popping up all the time when entering data.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top