Print a variable return from sub

G

Guest

I have this code in my detail section of a report

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim Diagnosis As String

If [Diagnosis 1] = -1 Then Diagnosis = [Diagnosis Code 1]
If [Diagnosis 2] = -1 Then Diagnosis = [Diagnosis Code 2]
If [Diagnosis 3] = -1 Then Diagnosis = [Diagnosis Code 3]
If [Diagnosis 4] = -1 Then Diagnosis = [Diagnosis Code 4]

Print Diagnosis

End Sub

I would like the Diagnosis variable to print in an unbound textbox.

I tried TextBoxname.text = Diagnosis
I got an object need focus error.

I tried Textboxname.text.setfocus
Textboxname.text = Diagnosis

I got a no record error.

How can I print this variable in a text box?
If I use the print function is there any way to control where it prints on
the form?
 
T

tina

have you tried simply

Me!TextBoxname = Diagnosis

along with removing the line of code

Print Diagnosis

hth
 

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

Top