Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a customized PID programmatically

Status
Not open for further replies.

maxiko

Programmer
Jul 5, 2006
2
US
I need to create a customized PID in VBA(MS ACCESS).
For example, a user at a hospital wants to enter a blood test for a patient. The user clicks on a form and submits blood test information. I want to create and store a customized PID(or label) that looks like this: BEQ001G01; BEQ001G02; BEQ001G03... BEQ0010G0n. So 01 would be the first entry. Next time it would be 02 and so on. Each PID is based on the previous ID. The BEQ portion can be based on some field from other table, example patient table.

I am new very new in VBA and any help would great!

Tnxs

M
 
A couple of things.

1. Is the BEQ something like the patient type or something that is associated with the patient.

How about the 001g part where does that come from.

My guess/thought (because there is not quite enough info) is that you should store the pid but build it at print time or input time.

The BEQ is probably your patient type taken from the screen where you have selected the patient to enter a blood sample from.

What the 001G is I do not know but is probably something related to the type of test and then

The only part left is the incrementing of the sample number for multiple test of the same type.


Instead of 1 field I would use 3 fields.
patType = BEQ
sampType = 001G
sampNum = n where N = the next sample.

Look into the DMAX function using the pattype and samptype to return the highest sampNum and then add 1.

When you write the new entry you will have all the data to concantenate the information to the printed label. There are several threads very similar in this forum for doing the same thing. I think one of them is a CD/DVD tracking system.



Andy Baldwin

"Testing is the most overlooked programming language on the books!
 
Hi Andy.
Thank you for your reply. The idea of creating patType, sampType and sampNum is interesting. I am not really new in working with databases, I normally work with MySQL/PHP and never played with VBA. That's why even basic things are holding me back.

And yes, you are right, those variables will be related to patient and test. It will be based on any previous information that is already saved on the patient.

I will look for the CD/DVD tracking system example. I hope I can find it. I did a quick search on this site but nothing came up.

If you happen to find it, let me know.

Thanks again.
F
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top