Using a Button to increment numbers in a database among other things.

  • Thread starter Thread starter coldfire
  • Start date Start date
C

coldfire

I know that it is difficult to assess and solve a problem without
being able to look at it physically. Therefore I have included a
download link to the database I am working on.

http://rapidshare.com/files/41280411/logbook1.accdb.html

I have been have some trouble with this database what I would like to
do is set up the logdb form to increment the lab number field with the
click of a button following a format of the last two digits of the
year "-" "0000", otherwise I would just like the field to be entered
with a format of "00"-"0000". I tried using a counter to do this but
to no avail. I have exhausted my knowledge of the vb language which is
virtually nothing any help would be appreciated. Thanks in advance.
 
CF, your requirements are unclear. You want a format like:
07-0001
07-0002
07-0003 etc

but you say "otherwise I want 00-0000"
What conditions cause the otherwise?

Are all of your 4 digit number in one sequence, or are there factors that
cause
the sequence to gap or cause multiple series of sequences?

Must all of the lab numbers in the table be unique?

Under what conditions are the first two digits NOT the decade?

UpRider
 
CF, your requirements are unclear. You want a format like:
07-0001
07-0002
07-0003 etc

but you say "otherwise I want 00-0000"
What conditions cause the otherwise?

Are all of your 4 digit number in one sequence, or are there factors that
cause
the sequence to gap or cause multiple series of sequences?

Must all of the lab numbers in the table be unique?

Under what conditions are the first two digits NOT the decade?

UpRider

The first two numbers are always the decade the reason that i don't
just want a field with an unchangeable incremented value is because i
will be entering backlogged cases from 2004-2006, and because some
cases will be duplicates only with a unique record number assigned to
them as they are supplements to the original.
The numbers will be seperate sequences for each year.
 
Answered in another newsgroup.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
CF,

I think your table design is faulty. The labDB table should contain the lab
number and little else. Then a new labDetail table that holds most of the
other fields should be created. A one to many relationship would allow you
to put as many supplemental records in the labDetail table for a given lab
number without duplicating the lab numbers in the labDB table. This would
allow you to make the lab number the Primary Key, which would disallow
duplicates in the main table and save you a LOT of trouble down the line.
A form with a subform would allow you to display all the records in the
detail table when the main table shows the lab number (Primary Key).
This is all basic stuff that should be worked out on paper before any coding
is done... :<)

HTH, UpRider
 
CF,

I think your table design is faulty. The labDB table should contain the lab
number and little else. Then a new labDetail table that holds most of the
other fields should be created. A one to many relationship would allow you
to put as many supplemental records in the labDetail table for a given lab
number without duplicating the lab numbers in the labDB table. This would
allow you to make the lab number the Primary Key, which would disallow
duplicates in the main table and save you a LOT of trouble down the line.
A form with a subform would allow you to display all the records in the
detail table when the main table shows the lab number (Primary Key).
This is all basic stuff that should be worked out on paper before any coding
is done... :<)

HTH, UpRider

will incrementing with a primary key allow records to be entered non
sequentially and still maintain a sequential numbering in the table?
 
CF, you don't care what order your records occur in the table because you
have absolutely no control over that. Tables are not for data display. They
are for data storage.
If you want to see your records in some particular order in a form or
report, you can control that.

UpRider
 
How about this, you input the year and computer appends next unused number
for sequence. I understand that you don't set the rules, just try to write
the code to implement. Look at below for one solution. Have system prompt
for the year and then assign the last number from the table for that year +
1. Increment with add one to last number. Problem is you must query data
to determine last number used for that year so depending on number of
records it might take a minute or two. If this will work what is the
highest number you expect to have after the - ?. Data base purists will not
understand this but working for the government I realize that many programs
still find their roots in 80 column punch cards and until those dudes retire
your stuck with a key that must satisfy those folks.
 
Back
Top