I have patient database and I want to incorporate a prescription form. Basically, all it is, is a a form that will allow 8 prescriptions to be written out but to be saved incase a refill is need. The medications I have in a table stored.
Let's say, Patient Joe Camel comes in... He needs to 3 prescriptions RX:Cancer sticks #5,000, SIG: 1 Q 1 Minute Till Death LabelFor:Lungs
RX:Hair-U-Lose,Sig 1gallon, LabelFor:
RX:Baclofen 10mg.; # ; sig 1/2tab b.i.d.x7d;LabelForBrain Spasticity
I know I can deisgn it:
tblMainTable PID(1) - tblDetails PID, MedID(M)
tblDetails PID, MedID(M) - tblMeds MedID(M)
I know I can then plug this into a subform and it will store my results. What my question, is it possible to have it Meds seperate from one another? On the form, I want to have tabs that says Med1, Med2, etc. and have meds sperate from one another.
Seriously, let me summarise my understanding of your requirement. You have a database with a parent-child relationship between Patients and Prescriptions. Each Patient may have zero to eight Prescriptions. You want to display a form containing Patient details that contains a sub form displaying Prescription details if any. The preferred format for the sub form is a tab control where each Prescription is shown separately, one to a page.
Is this possible? The answer is, yes I think so; but you doubtlessly want to know how. Well you are into the realm of formatting the tab control each and every time you display it.
First you need to count how many prescriptions there are for this patient and restrict the number of pages to the result. (Perhaps if this is less than eight you may want to include a page for entering a new, additional prescription. Personally however I would use a separate dialog form for this.) Then you need to label each page. Finally you need to populate each page.
I have in the back of my mind that you cannot duplicate control names even if they are on different pages of the tab control. (Anyone care to comment?) What I suggest is that you devise a standard layout and a consistent naming standard. For example Medicine01 is the medicine control on page 1, Medicine02 is that on page 2, and so on. Now populating the pages becomes a little easier.
Fortunately the page object in a tab control has a visible property so you can simply hide unused pages.
Thank you for the quick reply Rod. However, what you are suggestioning seems little bit too advanced for me, since I am starting out in Access and vba. I will look more into it and see if I can figure it out but I don't want to dwell too much on this if it beyond my capability.
Don't be apprehensive about getting into the 'nuts and bolts' of Access. After all VBA is the unifying language behind all Office (and some third party) applications; it is the Access GUI and Jet database that are non standard.
My advice would be to forget Access Macros and learn to do any more advanced requirements in VBA; that is, avoid learning macros and then relearning VBA. When you do get into VBA use the ActiveX Data Objects (ADO) model to access the Jet database. This at least 'standardizes' access to the Jet database such that you can communicate with any other ODBC database using exactly the same syntax as you do for Jet. Again don't learn DAO and then have to relearn ADO.
There has been some good advice from Bud and others about writing an Access Macro and then converting it to see what the equivalent VBA code looks like. Learning by example is a great way to start.
A final comment for the future is that VBA and ADO provide reasonable Object OrientATed Programming (OOP) features. Not everything is there (e.g. class inheritance is missing although interface inheritance is possible). Neither would you need to always use objects; sometimes accessing a database via a procedure is the best way to go. However all the world is becomming object orientated; all Access entities are in fact object classes and the forms, controls, reports, etc. that you work with are instants of those classes.
OK, lecture finished: I am prepared to help you out with your requirement as it has interested me. If you want we can explore how you can give me an declassified version of your mdb and then I can construct your tab control and the ways of manipulating it.