subform datasheet question

  • Thread starter mattc66 via AccessMonster.com
  • Start date
M

mattc66 via AccessMonster.com

I have a subform datasheet that I populate the first 2 fields by scanning
barcodes. There are more fields, but I want to advance to the next record
down so that we can contiune to scan in the data.

The additional fields are related, but auto fill based on what is scanned in.

How can I advance to the next record. I am going to try after update on the
last field. Would this be the correct event? Any suggestion on the event code?
 
M

mattc66 via AccessMonster.com

I added the following to the AfterUpdate event and it almost works.
DoCmd.GoToRecord , , acNewRec
It goes to the next record, but it put the courser at the same field as the
prev record. I need it to put the courser at the first field in the new
record.
 
M

mattc66 via AccessMonster.com

Okay answered my own question.

DoCmd.GoToRecord , , acNewRec
Me.Name.SetFocus

I added the following to the AfterUpdate event and it almost works.
DoCmd.GoToRecord , , acNewRec
It goes to the next record, but it put the courser at the same field as the
prev record. I need it to put the courser at the first field in the new
record.
I have a subform datasheet that I populate the first 2 fields by scanning
barcodes. There are more fields, but I want to advance to the next record
[quoted text clipped - 4 lines]
How can I advance to the next record. I am going to try after update on the
last field. Would this be the correct event? Any suggestion on the event code?
 
J

Jack Leach

Hi Matt... just a suggestion for you based on a few previous posts I've seen.
You might want to start adding some prefixes to the names you are using (for
forms, controls, variables, fields, etc). The name "Name" is a reserved
word, and should never be used as a name for something, and, in some previous
posts I noticed a few names of variables and fields that flirted with
reserved words as well.

I try to make sure that everything I come up with has a prefix of at least
one letter to avoid any problems. Problems with reserved words can range
from annoying to maddening. You can take a look around the web for Reddicks
Naming Conventions, but I'll give quick list of my preferences....

Objects:
tbl - Tables
fld - Fields (in tables)
cfld - Calculated Fields (in queries)
qry - Queries
frm - Forms
rpt - Reports
mod - Modules
mcr - Macros
ctl - Controls

Variables:
s - String
l - Long
i - Integer
b - Boolean
v - Variant
etc etc


If you get in the habit of prefixing all names of things with something, you
will never have an issue reserved words. Plus, it makes your code highly
readable by you and others by keeping things like variables and forms
controls easily distinguishable.


--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



mattc66 via AccessMonster.com said:
Okay answered my own question.

DoCmd.GoToRecord , , acNewRec
Me.Name.SetFocus

I added the following to the AfterUpdate event and it almost works.
DoCmd.GoToRecord , , acNewRec
It goes to the next record, but it put the courser at the same field as the
prev record. I need it to put the courser at the first field in the new
record.
I have a subform datasheet that I populate the first 2 fields by scanning
barcodes. There are more fields, but I want to advance to the next record
[quoted text clipped - 4 lines]
How can I advance to the next record. I am going to try after update on the
last field. Would this be the correct event? Any suggestion on the event code?

--
Matt Campbell
mattc (at) saunatec [dot] com



.
 
M

mattc66 via AccessMonster.com

Thank you that is great info.

Jack said:
Hi Matt... just a suggestion for you based on a few previous posts I've seen.
You might want to start adding some prefixes to the names you are using (for
forms, controls, variables, fields, etc). The name "Name" is a reserved
word, and should never be used as a name for something, and, in some previous
posts I noticed a few names of variables and fields that flirted with
reserved words as well.

I try to make sure that everything I come up with has a prefix of at least
one letter to avoid any problems. Problems with reserved words can range
from annoying to maddening. You can take a look around the web for Reddicks
Naming Conventions, but I'll give quick list of my preferences....

Objects:
tbl - Tables
fld - Fields (in tables)
cfld - Calculated Fields (in queries)
qry - Queries
frm - Forms
rpt - Reports
mod - Modules
mcr - Macros
ctl - Controls

Variables:
s - String
l - Long
i - Integer
b - Boolean
v - Variant
etc etc

If you get in the habit of prefixing all names of things with something, you
will never have an issue reserved words. Plus, it makes your code highly
readable by you and others by keeping things like variables and forms
controls easily distinguishable.
Okay answered my own question.
[quoted text clipped - 12 lines]
 

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