Group:  Microsoft Access » microsoft.public.access.formscoding
Thread: Automatic Table Entry

Geek News

Automatic Table Entry
tambourine63 <tbmedina[ at ]embarqmail.com> 11/21/2008 4:32:27 PM
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!
Re: Automatic Table Entry
"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> 11/21/2008 7:11:43 PM
"tambourine63" <tbmedina[ at ]embarqmail.com> wrote in message
news:df8f0364-ceea-4f46-bfe9-6a77076f1e5a[ at ]w35g2000yqm.googlegroups.com...
[Quoted Text]
> 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

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Re: Automatic Table Entry
tambourine63 <tbmedina[ at ]embarqmail.com> 11/22/2008 1:33:20 AM
On Nov 21, 2:11 pm, "Arvin Meyer [MVP]" <arv...[ at ]mvps.invalid> wrote:
[Quoted Text]
> "tambourine63" <tbmed...[ at ]embarqmail.com> wrote in message
>
> news:df8f0364-ceea-4f46-bfe9-6a77076f1e5a[ at ]w35g2000yqm.googlegroups.com...
>
> > 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
>
> --
> Arvin Meyer, MCP, MVPhttp://www.datastrat.comhttp://www.mvps.org/accesshttp://www.accessmvp.com

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!
Re: Automatic Table Entry
"Mike Painter" <mddotpainter[ at ]sbcglobal.net> 11/22/2008 2:39:13 AM
tambourine63 wrote:
[Quoted Text]
> On Nov 21, 2:11 pm, "Arvin Meyer [MVP]" <arv...[ at ]mvps.invalid> wrote:
> 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?


Re: Automatic Table Entry
"Arvin Meyer [MVP]" <arvinm[ at ]mvps.invalid> 11/22/2008 4:15:44 AM
"tambourine63" <tbmedina[ at ]embarqmail.com> wrote in message
news:545f72fc-c9fb-4b37-9080-587cb4980b62[ at ]t11g2000yqg.googlegroups.com...

[Quoted Text]
> 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
>
> --
> Arvin Meyer, MCP,
> MVPhttp://www.datastrat.comhttp://www.mvps.org/accesshttp://www.accessmvp.com

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.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Re: Automatic Table Entry
tambourine63 <tbmedina[ at ]embarqmail.com> 11/24/2008 6:21:29 PM
On Nov 21, 9:39 pm, "Mike Painter" <mddotpain...[ at ]sbcglobal.net> wrote:
[Quoted Text]
> tambourine63 wrote:
> > On Nov 21, 2:11 pm, "Arvin Meyer [MVP]" <arv...[ at ]mvps.invalid> wrote:
>
>  > 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?

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

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net