Getting a combo box to make an "X" on a report

  • Thread starter Thread starter Dana
  • Start date Start date
D

Dana

I am attempting to create a database using Access 97 that will, among
other things, fill out an insurance claim form called a HCFA 1500.
This is a pre-printed form that has several fields that need to have
boxes checked. For instance, the form has a check box for "male" or
"female" and for "married," "single," or "other." In my table I have
used a combo boxes for these data. When I create a report, it will
print the words, "single," "married," "female," etc. but what I need it
to do is make an "X" at a particular point on the report to correspond
with the appropriate box in the HCFA 1500 form. For example, I might
want an "X" in the report to be placed 2.5" from the left margin and
4.5" from the top if the value in the Gender combo box is "male" and an
"X" to be placed 2.75" from the left margin and 4.5" from the top if
the value in the Gender combo box is "female."

I do not know code and am not sure where it would go if someone gave it
to me- creating macros is about as sophisticated as I get. Is there a
relatively easy way for me to accomplish this goal?

Thanks in advance for any help you can give me.

Dana
 
I think you'll need to learn a bit of simple code. Macros are actually much
more complex for something like this. The trick is to scan your form, full
size and then paste the image in an Access report. Place check boxes at
every position and name them so it is easier to keep track of them. So now
let's deal with a combobox named cboGender. Depending if you are storing
numerics (probably 1 or 2) or text ("male" or "female") in the underlying
table, your code would look something like:

Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If Me!Gender = "male" Then
Me.chkMale = True
ElseIf Me!Gender = "female" Then
Me.chkFemale = True
Else
Me.chkMale = False
Me.chkFemale = False

End Sub

and repeat the process for each set of fields. After you've placed all your
checkboxes and deleted all their labels, written and tested your code, you
can delete the image so only the checkboxes are left. Instead of checkboxes,
you may want to used small textboxes with the letter "x" in them. That way
you won't need to print the border of the checkbox.
 
Sounds like I am creating a similar database but with health insurance forms
where I want the report to "x" male or female, "x" married, single, divorce,
etc.

For male/female, create two text boxes with the letter "x" in them. Name one
male and one female and place them over the respected boxes on your report.

On the form that triggers the report to print or preview, make sure you have
the field with male/female on it. (you can make it invisible so the end-user
never sees it).

Now, back on your report, create a simple vb code on the OnOpen function of
the report. (You will have to have the form open with the male/female
information open for the report to pull). Make sure that the two text boxes
with "x"s you created are set to visible, then use this code:

If Formwithinfo.Fieldwithinfo = "M" Then
Me.male.visible = True
Else
Me.female.visible = Female

This assumes that your male/female field requires data, if not, you will not
know if the field is blank. If you don't want this assumed, just create a
second IF statement for female:

If Formwithinfo.Fieldwithinfo = "M" Then
Me.male.visible = True
Else
If Formwithinfo.Fieldwithinfo = "F" Then
Me.female.visible = True
End If
End If

B
Me.female.visible = Female
 
Correction on the above, make sure you two text boxes are set to INVISIBLE.
Sorry bout that.

B
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top