Conditional Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am interested in developing a form which is conditional. I'll explain. I am
a doctor and I want to design a database to keep my billing from various
hospitals. I wanted to design a form , where when I enter "hospital A" then
one particular subform opens up and when I enter "Hospital B " then another
subform opens up, and so on. Can I do this as a control on the tools box
(Which as far as I know, does not exist ) ,. Can I do this without knowing
visual basic?
 
There are a number of ways to do what you want. Probably
the simplest way is to design a separate form for each
hospital and then create a switchboard (Tools, Switchboard
manager) where you can just click a button to open the
form you want. You can set up your switchboard for all
your forms, reports, queries, etc and it can function as a
Main Menu for your application. It's fairly easy to set up
and modify. No coding needed! You can even set it up to
open automatically when you open the .mdb file by setting
it as your startup form (Tools, Startup, Display
Form/Page).

HTH!
Bonnie

-----Original Message-----
I am interested in developing a form which is
conditional. I'll explain. I am
a doctor and I want to design a database to keep my billing from various
hospitals. I wanted to design a form , where when I enter "hospital A" then
one particular subform opens up and when I
enter "Hospital B " then another
 
On Mon, 20 Dec 2004 08:29:03 -0800, Dr Alok Modi MD <Dr Alok Modi
I am interested in developing a form which is conditional. I'll explain. I am
a doctor and I want to design a database to keep my billing from various
hospitals. I wanted to design a form , where when I enter "hospital A" then
one particular subform opens up and when I enter "Hospital B " then another
subform opens up, and so on. Can I do this as a control on the tools box
(Which as far as I know, does not exist ) ,. Can I do this without knowing
visual basic?

Well, you'll need some VBA but you can probably get some help here
writing it; but... I'm concerned at the need to do this. In what way
are the subforms for HospitalA and HospitalB different? If they differ
only in which records from a Table they present, you should not be
using different subforms; instead, you'ld just change the Query, or
use the Master/Child Link Fields to filter the records presented to
show HospitalA records vs. HospitalB records. You would only need to
actually use different subforms if the *structure of the Form itself*
were different.

So... what's on these Subforms? What are their Recordsources?

John W. Vinson[MVP]
 
You need to seriously consider what John Vinson has to say; ie, your table
design may not be correct. Given you do need to have a separate subform for
each hospital and there are not too many hospitals, you could use a tab
control and put each hospiyal and it's subform on a separate tab.

I am in business to provide customers with a resource for help with Access.
If you need help, please contact me at my email address below.
 
PC Datasheet said:
You need to seriously consider what John Vinson has to say; ie, your table
design may not be correct. Given you do need to have a separate subform for
each hospital and there are not too many hospitals, you could use a tab
control and put each hospiyal and it's subform on a separate tab.

I am in business to provide customers with a resource for help with Access.
If you need help, please contact me at my email address below.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com





I think I have not made myself clear. None of the replies have what I seek. What I meant is this:
I have some common fields like
1. First Name
2. Second Name
3. Age
4. Sex
Date of Admission
6. Date of Discharge
7. Hospital where patient admitted
Now this form is going to have a combo box control, so I can choose from the
4 hospitals that I have admitted the patient in.
Now since the above 6 fields are common fields to all the hospitals, what
follows after the seventh field is different namely
7. Bed charges
9. Nursing charges
10. Visit charges etc.

I wanted to design without VB so that the moment I select "Hospital A" in
the hospital type I get "subform A" which has these fileds namely 7, 8, 9 etc
different for subform A , subform B for hospital B , subform C for hospital;
C etc ?

I hope I am more clear.
It does not serve my purpose to design four different subforms and link them
to the main switchboard, and enter the above 6 fields common to various
hospitals again, Also it is poor table desin because it will mean having four
different tables having the above 6 fields having common data types for the
four hospitals.

Regards
Dr Alok Modi MD
 
Your table design is not correct. Consider this design:

TblHospital
HospitalID
HospitalName

TblPatient
PatientID
Firstname
LastName
Sex
Age

TblAdmission
AdmissionID
PatientID
HospitalID
DateOfAdmission
DateOfDischarge

TblChargeType
ChargeTypeID
ChargeType 'Bed, Nursing,Visit,etc

TblCharge
ChargeID
AdmissionID
DateOfCharge
ChargeTypeID
ChargeAmount
 
this is then code in event AfterUpdate, object name
Cuadro_combinado68
where name the form is
FRM_hospital a
FRM_hospital b

==========
Private Sub Cuadro_combinado68_AfterUpdate()
On Error GoTo Err_Comando41_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "FRM_" & me.Cuadro_combinado68
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Comando41_Click:
Exit Sub

Err_Comando41_Click:
MsgBox Err.Description
Resume Exit_Comando41_Click

End Sub
 
Back
Top