By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,215 Members | 1,293 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,215 IT Pros & Developers. It's quick & easy.

How to check data entered into a form is accurate with data in a table?

P: 3
I have a form (Form A), where I require the user to enter a CustomerID which they have created using a separate form (Form B) and which the data is stored in (Table B).

How would I go about checking the CustomerID they enter into Form A is an exact match to one of the CustomerID's stored in Table B?

I guess I'm struggling with finding the code to cross-reference between sources of data.

Any help or advise would be greatly appreciated.
Dec 21 '11 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 15k+
P: 31,707
Instead of allowing them to type the data in, why not provide a ComboBox which is populated with the valid entries from the other table?
Dec 21 '11 #2

P: 3
That's one option.

How would I ensure that CustomerID's that have already made choices over what products they wish to purchase (and therefore, have their details stored in a separate table) are not present in the combo box?

To rephrase, I only want CustomerID's that haven't made their purchase choices available for picking.
Dec 23 '11 #3

Expert Mod 15k+
P: 31,707
You simply ensure the ComboBox is populated by those items which fit your criteria.

Something like :

Expand|Select|Wrap|Line Numbers
  1. SELECT tC.CustomerID
  2.      , tC.CustomerName
  3. FROM   [tblCustomer] AS [tC]
  4.        LEFT JOIN
  5.        [tblPurchase] AS [tP]
  6.   ON   tC.CustomerID = tP.CustomerID
  7. WHERE  (tP.CustomerID Is Null)
Dec 23 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.