Mandating form based on combo selection (1 Viewer)

lizcliff

Registered User.
Local time
Today, 09:55
Joined
Feb 23, 2013
Messages
38
Hi

i have a inpatients form with several sub forms on control tabs, on the stroke admission sub form where someone selects primary findings=IPH I need to make the HAEM subform mandatory for all text and combo boxes.
Do I do this for each box or can it be applied across all boxes on that form?

thanks

liz
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:55
Joined
Oct 29, 2018
Messages
21,478
Hi liz. You can employ a "loop" to check all controls on the form based on specific requirements. You could add a Tag to each control or create a list of all controls to check in a table or array. Just a thought...
 

lizcliff

Registered User.
Local time
Today, 09:55
Joined
Feb 23, 2013
Messages
38
Thanks Db guy - errm blown my mind, how would I do that?
sounds good though!
 

lizcliff

Registered User.
Local time
Today, 09:55
Joined
Feb 23, 2013
Messages
38
Thanks! this is really good and I 'think' easy to understand (for me) I will have a go!! :)
 

lizcliff

Registered User.
Local time
Today, 09:55
Joined
Feb 23, 2013
Messages
38
Hi
I had a go, but it hasn't worked.
I changed the code to:
If Me.[Primary Findings] = "IPH" Then
For lngItem = 0 To Me.IPHlist.ListCount - 1
If IsNull(Me.Controls(Me.IPHlist.ItemData(lngItem))) Then
Cancel = True
MsgBox "Please complete all information in Haemorrhagic Stroke Form.", vbInformation, "Required"
Exit For
End If
Next
End If


my list box is a list of all the combo boxes on the haem form that need to be mandated, in the row source
I have it placed on the haem subform hidden.

the code I place on the form before update.

thanks
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:55
Joined
Oct 29, 2018
Messages
21,478
Hi. Sorry to hear that. How exactly did it not work? Did you get an error? What is the Row Source of your Listbox? Are you able to post a small copy of your db?
 

lizcliff

Registered User.
Local time
Today, 09:55
Joined
Feb 23, 2013
Messages
38
Hi

not sure I can with patient detail in,
no error just closed form without message warning.

erm I used the row source query on my table to bring the fields in - now i've pasted it it doesn't look much like a list - is this why?


SELECT tbl_Inpatients.[Haem Discussion with Neuro Centre], tbl_Inpatients.[What was the first systolic B/P mmHg], tbl_Inpatients.[Date Systolic B/P first at 140 mmHg], tbl_Inpatients.[Time Systolic B/P first at 140 mmHg], tbl_Inpatients.[Anticoagulant reversal therapy given], tbl_Inpatients.[Was anticoagulation reversal treatment given date], tbl_Inpatients.[Was anticoagulation reversal treatment given time], tbl_Inpatients.[First admitting ward], tbl_Inpatients.[Stroke Unit bed booked time], tbl_Inpatients.[Transfer delay], tbl_Inpatients.[Haem Discussion Outcome], tbl_Inpatients.[Date acute blood pressure management given -within 24 only], tbl_Inpatients.[Time acute blood pressure management given -within 24 only], tbl_Inpatients.[Acute B/P Treatment used], tbl_Inpatients.[What reversal agent was given], tbl_Inpatients.[First ward Date of admission], tbl_Inpatients.[First ward Time of admission], tbl_Inpatients.[If first ward NOT Stroke Unit - date transferred], tbl_Inpatients.[If first ward NOT Stroke Unit - time transferred], tbl_Inpatients.[Reason not for stroke unit] FROM tbl_Inpatients;
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:55
Joined
Oct 29, 2018
Messages
21,478
Well, I thought you said your Listbox contains the names of your comboboxes. Does that SQL statement produce a list of combobox names?
 

lizcliff

Registered User.
Local time
Today, 09:55
Joined
Feb 23, 2013
Messages
38
Hi I have made a copy, taking out all patient details, and making up a few to have in there, then compacting it - and its still over allowed amount to upload - how do you get around that?:banghead:
 

lizcliff

Registered User.
Local time
Today, 09:55
Joined
Feb 23, 2013
Messages
38
Well, I thought you said your Listbox contains the names of your comboboxes. Does that SQL statement produce a list of combobox names?

it just puts it all into a table but that not what I need is it,
Should I just type them all into row source?

thx
 

lizcliff

Registered User.
Local time
Today, 09:55
Joined
Feb 23, 2013
Messages
38
here is a screen shot of my row source - ive changed it to just a list - and still nothing?
listbox.png
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:55
Joined
Oct 29, 2018
Messages
21,478
Hi I have made a copy, taking out all patient details, and making up a few to have in there, then compacting it - and its still over allowed amount to upload - how do you get around that?:banghead:
Hi. You can email it to me, and I'll take a look.
 

Users who are viewing this thread

Top Bottom