If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Unanswered: Data Validation Question

I have a form named "Claims Tracking System" and another named "Client Database". On the Claims form I have three fields "Account Number", "Client Name" and "State". In the Client Database, I have fields "Client Name" and I have fields for all 50 states and in the text boxes that correspond with each state there is an account number.

When a user enters an account number in the claims form, I want the employer and state to be filled in automatically based on the data in the Client Database. If the user enters a wrong account number, I need an error message to appear.

Either I don't understand or there is something wrong in what you describe. You do not store data into a form, data reside in tables, which forms can display.

As for retrieving data from a table and provided that you have a unique identifier that works for both the current data in the form and the data in a related tables, there are several techniques:

- Use a Combo or a Listbox whith several columns. The common value is selected from the visible column of the combo or list and the other values are extracted from the other (possibly hidden) columns of the object using:

Code:

Me.ComboName.Column(x)

Where x represents the position of the column with x=0 for the first (leftmost) column.

- Use a set of DLookUp() functions, one for each data to be retrieved.

- Open a Recordset on the data provider table. This is often more efficient than the use of DLookUp() when there are many pieces of data to retrieve.

- If the form is bound, it's also possible (sometimes) to write a query that will include the desired information and use it as the RecordSource of the form.

Well, I should have been more specific. The data is stored in a table which is displayed on the form in which the user enters more data. Tables have the same names as my forms. Maybe this helps clear it up. Thanks!