VBA Sub Form in Report not showing data

G

Guest

I have a sub form containing address data.
The form has been modified to include a VBA makeaddress text box.
When the subform is added into a report the basic data is shown along with
the outline of the VBA text boxBUT not data is shown in the VBA box.
What do I need to do in order to trigger the text in the VBA box in the
report.
Thanks
 
D

Duane Hookom

I don't think anyone reading this has ever heard of a "VBA text box". If you
are using VBA, perhaps you could provide use with the code.
 
G

Guest

Thanks for coming back, maybe my language is wrong and hopefully the code
will help.
In Modules I have: -
------------------------
Function MakeAddressBox(a1, a2, a3, a4)

On Error GoTo Err_MakeAddressBox

MakeAddressBox = (a1 + vbCrLf) & (a2 + vbCrLf) & (a3 + vbCrLf) & (a4 +
vbCrLf)

Exit_MakeAddressBox:

Exit Function

Err_MakeAddressBox:

MsgBox Err.Description & Err.Number

Resume Exit_MakeAddressBox

End Function
--------------------

In a subform I have 4 field Ad1 (which can have several lines), City,
County and PostCode.

Beside these I have an unbound text box 62 that has the following code: -

-----------------
Option Compare Database

Private Sub Form_AfterUpdate()
Text62 = MakeAddressBox([Ad1], [City], [County], [PostCode])

End Sub

Private Sub Form_Current()

Text62 = MakeAddressBox([Ad1], [City], [County], [PostCode])
End Sub
---------------------------
The module and the subform code compact the address data. When the subform
is inserted in a report the subform field can be seen along with only the
outline of the text box. What I am trying to do is to display only the
compacted text box in the report. I can hide the field display easily enough
but cannot display the data that is in the subform unbound text box. Any
ideas?

Thanks
 
D

Duane Hookom

Why don't you just set a control source to:
=MakeAddressBox([field1], [Field2], [Field3], [Field4])

--
Duane Hookom
MS Access MVP


Mike Tilley said:
Thanks for coming back, maybe my language is wrong and hopefully the code
will help.
In Modules I have: -
------------------------
Function MakeAddressBox(a1, a2, a3, a4)

On Error GoTo Err_MakeAddressBox

MakeAddressBox = (a1 + vbCrLf) & (a2 + vbCrLf) & (a3 + vbCrLf) & (a4 +
vbCrLf)

Exit_MakeAddressBox:

Exit Function

Err_MakeAddressBox:

MsgBox Err.Description & Err.Number

Resume Exit_MakeAddressBox

End Function
--------------------

In a subform I have 4 field Ad1 (which can have several lines), City,
County and PostCode.

Beside these I have an unbound text box 62 that has the following code: -

-----------------
Option Compare Database

Private Sub Form_AfterUpdate()
Text62 = MakeAddressBox([Ad1], [City], [County], [PostCode])

End Sub

Private Sub Form_Current()

Text62 = MakeAddressBox([Ad1], [City], [County], [PostCode])
End Sub
---------------------------
The module and the subform code compact the address data. When the subform
is inserted in a report the subform field can be seen along with only the
outline of the text box. What I am trying to do is to display only the
compacted text box in the report. I can hide the field display easily enough
but cannot display the data that is in the subform unbound text box. Any
ideas?

Thanks

Duane Hookom said:
I don't think anyone reading this has ever heard of a "VBA text box". If you
are using VBA, perhaps you could provide use with the code.
 
G

Guest

sounds a lot simpler - I'll give it a try - thank you

Duane Hookom said:
Why don't you just set a control source to:
=MakeAddressBox([field1], [Field2], [Field3], [Field4])

--
Duane Hookom
MS Access MVP


Mike Tilley said:
Thanks for coming back, maybe my language is wrong and hopefully the code
will help.
In Modules I have: -
------------------------
Function MakeAddressBox(a1, a2, a3, a4)

On Error GoTo Err_MakeAddressBox

MakeAddressBox = (a1 + vbCrLf) & (a2 + vbCrLf) & (a3 + vbCrLf) & (a4 +
vbCrLf)

Exit_MakeAddressBox:

Exit Function

Err_MakeAddressBox:

MsgBox Err.Description & Err.Number

Resume Exit_MakeAddressBox

End Function
--------------------

In a subform I have 4 field Ad1 (which can have several lines), City,
County and PostCode.

Beside these I have an unbound text box 62 that has the following code: -

-----------------
Option Compare Database

Private Sub Form_AfterUpdate()
Text62 = MakeAddressBox([Ad1], [City], [County], [PostCode])

End Sub

Private Sub Form_Current()

Text62 = MakeAddressBox([Ad1], [City], [County], [PostCode])
End Sub
---------------------------
The module and the subform code compact the address data. When the subform
is inserted in a report the subform field can be seen along with only the
outline of the text box. What I am trying to do is to display only the
compacted text box in the report. I can hide the field display easily enough
but cannot display the data that is in the subform unbound text box. Any
ideas?

Thanks

Duane Hookom said:
I don't think anyone reading this has ever heard of a "VBA text box". If you
are using VBA, perhaps you could provide use with the code.

--
Duane Hookom
MS Access MVP


I have a sub form containing address data.
The form has been modified to include a VBA makeaddress text box.
When the subform is added into a report the basic data is shown along with
the outline of the VBA text boxBUT not data is shown in the VBA box.
What do I need to do in order to trigger the text in the VBA box in the
report.
Thanks
 

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