Getting report to show texts together based on fields on Form: Txt formatting issue

AKPMD

New member
Local time
Today, 15:39
Joined
Aug 31, 2009
Messages
3
Hello all!

I'm new to this forum and so far it looks great! I'm, unfortunately, also new to Access and have been trying to learn on my own, so please bear with me.

My question is:

I have a form with combobox fields, for example, smoking and sleeping for patients.

Then, I've managed to create a button that would generate a report based on the information on that record, ie. patient data and such using the

DoCmd.OpenReport strReportName, acViewPreview, , strCriteria

Here's the thing... I am trying to find the best way to display certain texts based on fields in the form so that the texts remain together.

For example, if smoking combobox in form is "yes", then in Report a text saying

"Patient needs to stop smoking"

exists. But, also if Sleeping combobox is also "yes", then in the report, the paragraph is now:

"-Patient needs to stop smoking.
-Patient needs more sleep"

And so on. I want to create it so that the paragraph is able to grow, and that there's no gap in between the patient needs to stop smoking and patient needs more sleep.


What I currently have, though it's kinda messy, is that I added a whole bunch of footers, each footer with its own corresponding message (ie. -patient needs to stop smoking) and have them stacked. Then I used the:

If Forms!MasterTable.TriageOptionsSmoking = "Yes" Then
triageSmokingFooter.Visible = True
Else
triageSmokingFooter.Visible = False
End If

to get the footers to show, or not show, but this way at least there won't be any gaps between the txts. Im reluctant to use this method, because it requires me to make lots of footers, and also have those footers/groups connected to tables?

Sorry if this post is too long, I've been working real hard to find a solution to this. Any help from you guys would be greatly appreciated.


AKP

PS: Using Access 2000 on Win 2000. :)
 
You can make a string at opening of report

For example

Code:
Dim StrFooter as string

if Forms!MasterTable.TriageOptionsSmoking = "Yes" Then

strfooter="-Patient needs to stop smoking."

end if

if Forms!MasterTable.TriageOptionsSomething = "Yes" Then

strfooter=StrFooter & vbcrlf &  "-Some More text here."

end if

if Forms!MasterTable.TriageOptionsSomeOtherthing = "Yes" Then

strfooter=StrFooter & vbcrlf &  "-Some More text here."

end if

give a string for each your option
 
Thank you Khawar!

I'm going to give it a shot

*Crosses fingers
 
You can make a string at opening of report

For example

Code:
Dim StrFooter as string

if Forms!MasterTable.TriageOptionsSmoking = "Yes" Then

strfooter="-Patient needs to stop smoking."

end if

if Forms!MasterTable.TriageOptionsSomething = "Yes" Then

strfooter=StrFooter & vbcrlf &  "-Some More text here."

end if

if Forms!MasterTable.TriageOptionsSomeOtherthing = "Yes" Then

strfooter=StrFooter & vbcrlf &  "-Some More text here."

end if
give a string for each your option

Ok, it works! But, instead of using strfooter, I used TextBoxName, which works the same.

AKP
 

Users who are viewing this thread

Back
Top Bottom