Subject: Conditional default value
Posted By: twalter Post Date: 1/1/2006 7:58:35 PM
UGH!  I'm a self taught VBA programmer so, forgive me if this isn't clear.

I've been trying for a couple days to figure out. . . I have a form with 3 fields cboControl, cboClass and txtCount which writes to an Entries table. Here's what my table looks like -

MyTable:
Control #(PK), Class, Count
123, 1.1, 1
123, 1.1, 2
123, 1.2, 1
123, 1.2, 2
987, 1.1, 1
987, 1.1, 2
987, 1.2, 1
987, 1.2, 2

In the table I have a rule on the Count field that the value can only be 1 or 2 and I have the default value set to 1.  So, as the user submits entries they must evaluate previous entries to determine if the count should be 1 or changed to 2.  What they are asking for is for the form to do this evaluation and default the count based on entries that exist for the Control # and Class.  Hope this makes sense.

I've tried different Event Procedures and just can't seem to make it recognize the previously entered data at the right time.

Thanks for any help!!

Reply By: marcostraf Reply Date: 1/3/2006 5:31:06 PM
Is the Count the number of records with same values for Control# and Class? if that so, it is redondant because you can use the SELECT COUNT query (and much safier) Never store in a database something that can be computed.
Marco

Go to topic 38175

Return to index page 404
Return to index page 403
Return to index page 402
Return to index page 401
Return to index page 400
Return to index page 399
Return to index page 398
Return to index page 397
Return to index page 396
Return to index page 395