Automatic Table Entry

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!
 
A

Arvin Meyer [MVP]

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
 
T

tambourine63

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!
 
M

Mike Painter

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?
 
A

Arvin Meyer [MVP]

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.
 
T

tambourine63

 > 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top