Automatic Table Entry

  • Thread starter Thread starter tambourine63
  • Start date Start date
T

tambourine63

I'll try to make this question simple.
If I have a table with fields 1, 2, and 3, can I make field 3 default
to the value of "1" if fields 1 and 2 are value "0"?
Thanks!
 
tambourine63 said:
I'll try to make this question simple.
If I have a table with fields 1, 2, and 3, can I make field 3 default
to the value of "1" if fields 1 and 2 are value "0"?
Thanks!

If using a form for data entry, and you should be, in the after update event
of the form, you can add a bit of code which does:


Private Sub Form_AfterUpdate()

If Field1 + Field2 = 0 Then Field3 =1

End Sub
 
If using a form for data entry, and you should be, in the after update event
of the form, you can add a bit of code which does:

Private Sub Form_AfterUpdate()

    If Field1 + Field2 = 0 Then Field3 =1

End Sub

Well, the reason I'm not using a form is if I put all the 3rd fields
on there, my query and form have over 255 fields. That's why I
eliminated them. But I was hoping I could do something to get the
table to store a 1 if I don't choose anything on the form.

Thanks!
 
tambourine63 said:
Well, the reason I'm not using a form is if I put all the 3rd fields
on there, my query and form have over 255 fields. That's why I
eliminated them. But I was hoping I could do something to get the
table to store a 1 if I don't choose anything on the form.

Thanks!

I'm not sure what you are trying to do but will bet a nickel that your
tables are poorly designed.
Do some of these fields hold the same kind of information?
Do you have Mon, Tues, Wed... fields?
 
If using a form for data entry, and you should be, in the after update
event
of the form, you can add a bit of code which does:

Private Sub Form_AfterUpdate()

If Field1 + Field2 = 0 Then Field3 =1

End Sub

Well, the reason I'm not using a form is if I put all the 3rd fields
on there, my query and form have over 255 fields. That's why I
eliminated them. But I was hoping I could do something to get the
table to store a 1 if I don't choose anything on the form.

Although a table or query can take up to 255 fields, I can't remember the
last time I designed one with more than 30. Most tables have 10 or less
fields in a well-designed database.

Never-the-less, a form can house 754 controls over its lifetime which means
if you use all text and combo boxes, and never deleted any, you could, with
labels build 374 controls, and without labels, the full 754. That's a lot
more than will fit in any query or table.
 
 > Well, the reason I'm not using a form is if I put all the 3rd fields



I'm not sure what you are trying to do but will bet a nickel that your
tables are poorly designed.
Do some of these fields hold the same kind of information?
Do you have  Mon, Tues, Wed... fields?

LOL! You wouldn't be the first to tell me that. I've designed and re-
designed this database so many times, I'm tired of looking at it.

If I can find the place to post files, I'll upload what I'm doing to
let you see. Maybe you have a solution you can explain to me better
than the last group I belonged to.

Thanks a bunch!
Tammy
 
Back
Top