Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / November 2006

Tip: Looking for answers? Try searching our database.

Automatic value increment upon creating new record in subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
etter34@gmail.com - 30 Nov 2006 15:29 GMT
Hello,

First, I know automatic value increment has been talked about a lot,
but I can't seem to get this particular issue resolved.  Basically what
I have are "Case numbers" (automatically assigned) and then "patient
id's" within that case number.  So if we want to enter in 3 patients
that came in at the same time, they'd all be under the same case
number.

I've got a form with the "case number" that is automatically
incremented when a case comes in, and then a subform with the "patient
id" and patient info  that needs to increase when people click new
record.  The "Patient ID" field should match the record number in the
navigation bar.   Currently, whenever someone clicks new record they
have to manually change the "patient id" since it does not
automatically increment.

I hope this makes sense!  I want "patient id" to increase automatically
for each "case number" in the short!

Any direction to examples, etc?  Thanks so much!
kingston - 30 Nov 2006 17:01 GMT
Your description of what you want to happen would lead to duplicate Patient
IDs:

Case 1
  Patient 1
  Patient 2
  Patient 3

Case 2
  Patient 1
  Patient 2

If this is the case, Patient ID is not really an ID in the sense of a data
table key (it can be part of a composite ID but I'm not sure if that's what
you're trying to do).  Do you have a real ID for patient information?  If so,
good, and we'll call the number you want PatientCount instead.  You can get
the current PatientCount using something like: DCount("*","CasePatientTable",
"[CaseID]=12").  Naturally, you need to substitute the real table name and
field name.  If CaseID is not numeric, you'll need to add single quotes
around the value.  If you place this in a form, you can replace the criteria
with something like: "[CaseID]=" & Me.CaseID.  Thus, the next PatientCount
would simply be DCount(...)+1.

In summary, CaseID will be an autonumber, PatientID should be an autonumber
(hopefully), and PatientCount will be calculated.  There are potential
problems and inefficiencies with adding a PatientCount field (what if a
patient is deleted from a case - do you reassign all the numbers?).  So, it
would be much better if you could work with two true IDs (Case and Patient)
that are automatically assigned.

>Hello,
>
[quoted text clipped - 17 lines]
>
>Any direction to examples, etc?  Thanks so much!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.