how to pass data to report?

M

michael

I apologise for being a newbie, but I have searched many a forum to try to
figure out how to pass a variable to a report. On one of my forms I have a
command button that creates a list of variables that I need to print a
barcode (PDF417 2D), and then call the report to print. I need to use this
variable (stBarCode) in the report. I have an ActiveX Control ( to use the
PDF417 dll) to print the barcode. I can put in the ControlSource any of the
fields available, but I need to print the stBarCode variable.

Any help would be a be GREAT.....

TIA,
michael
 
D

Duane Hookom

You could use an invisible text box to store the stBarCode. Then in your
report, use:
=Forms!frmYourForm!txtBarCode
Otherwise, you could use a variable declared in the declarations section of
a standard module.
 
M

michael

Duane,

Thanks, that was fast! Again, newbie talking, but what do you mean by
invisible text box? The variable is declared in the OnClick of the command
buttom. Can't I just use stBarCode in the ControlSource of the text box on
the report?

tia,
michael
 
D

Duane Hookom

Could you share the OnClick code?
Do you know what a text box is and invisible is?
Do you know how to use code to place a value in an unbound text box?
 
M

michael

Duane,
Sorry for the delay, I could not the forum reloaded.
The OnClick is: (sorry so long)

Private Sub cmdPrintLaserBadge_Click()
On Error GoTo Err_cmdPrintLaserBadge_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim stQuote As String
Dim stRegName1 As String
Dim stRegName2 As String
Dim stStartBadge As String
Dim stSpace As String
Dim stCRLF As String
Dim stEndLine As String
Dim stEndBadge As String
Dim stBarcode As String
stQuote = Chr(34)
stStartBadge = Chr(2) & Chr(2) & Chr(2)
stSpace = Chr(3)
stCRLF = Chr(13) & Chr(10)
stEndLine = Chr(3) & Chr(31) & stCRLF
stEndBadge = stCRLF & stCRLF & stCRLF & stCRLF & Chr(26)
stBarcode = stQuote & stStartBadge & Me.RegID & stEndLine &
Me.First_Name & stSpace & " " & stSpace & Me.Last_Name & stEndLine & Me.Title
& stEndLine & Me.Company & stEndLine & Forms!Company!Address1 & stEndLine &
Forms!Company!Address2 & stEndLine & Forms!Company!City & stSpace & ", " &
stSpace & Forms!Company!State & stSpace & " " & stSpace &
Forms!Company!Postal & stEndLine & Forms!Company!Country & stEndLine &
Forms!Company!Phone & stEndLine & Forms!Company!Fax & stEndLine & Me.Email &
stEndLine & stEndBadge & stQuote

MsgBox stBarcode

If Forms!Company!Text82 = 0 Then
stDocName = "Labels Registrants on laser stock"
stLinkCriteria = "[RegID]=" & Me![RegID]
DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria
Me.Printed = True
Me.Number_Printed = Me.Number_Printed + 1
Else
MsgBox "Can't Print Badge there is a Payment Due!"
End If
Exit_cmdPrintLaserBadge_Click:
Exit Sub
Err_cmdPrintLaserBadge_Click:
MsgBox Err.Description
Resume Exit_cmdPrintLaserBadge_Click
End Sub
(the MsgBox is for my help only)

Yes on the TextBox, but No on invisible
No.
But, if I get pointed in the correct direction I should be able to figure it
out.
( i am a former dbase/Fox programmer very former)
TIA,
michael
 
D

Duane Hookom

Add a text box "txtBarCode" to your form and set its visible property to No.
Then add a line of code after you set stBarCode
Me.txtBarCode = stBarCode
Then, in your report you can add a text box with a control source of
something like:

=Forms!frmYourFormName!txtBarCode

--
Duane Hookom
MS Access MVP
--

michael said:
Duane,
Sorry for the delay, I could not the forum reloaded.
The OnClick is: (sorry so long)

Private Sub cmdPrintLaserBadge_Click()
On Error GoTo Err_cmdPrintLaserBadge_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim stQuote As String
Dim stRegName1 As String
Dim stRegName2 As String
Dim stStartBadge As String
Dim stSpace As String
Dim stCRLF As String
Dim stEndLine As String
Dim stEndBadge As String
Dim stBarcode As String
stQuote = Chr(34)
stStartBadge = Chr(2) & Chr(2) & Chr(2)
stSpace = Chr(3)
stCRLF = Chr(13) & Chr(10)
stEndLine = Chr(3) & Chr(31) & stCRLF
stEndBadge = stCRLF & stCRLF & stCRLF & stCRLF & Chr(26)
stBarcode = stQuote & stStartBadge & Me.RegID & stEndLine &
Me.First_Name & stSpace & " " & stSpace & Me.Last_Name & stEndLine &
Me.Title
& stEndLine & Me.Company & stEndLine & Forms!Company!Address1 & stEndLine
&
Forms!Company!Address2 & stEndLine & Forms!Company!City & stSpace & ", " &
stSpace & Forms!Company!State & stSpace & " " & stSpace &
Forms!Company!Postal & stEndLine & Forms!Company!Country & stEndLine &
Forms!Company!Phone & stEndLine & Forms!Company!Fax & stEndLine & Me.Email
&
stEndLine & stEndBadge & stQuote

MsgBox stBarcode

If Forms!Company!Text82 = 0 Then
stDocName = "Labels Registrants on laser stock"
stLinkCriteria = "[RegID]=" & Me![RegID]
DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria
Me.Printed = True
Me.Number_Printed = Me.Number_Printed + 1
Else
MsgBox "Can't Print Badge there is a Payment Due!"
End If
Exit_cmdPrintLaserBadge_Click:
Exit Sub
Err_cmdPrintLaserBadge_Click:
MsgBox Err.Description
Resume Exit_cmdPrintLaserBadge_Click
End Sub
(the MsgBox is for my help only)

Yes on the TextBox, but No on invisible
No.
But, if I get pointed in the correct direction I should be able to figure
it
out.
( i am a former dbase/Fox programmer very former)
TIA,
michael

Duane Hookom said:
Could you share the OnClick code?
Do you know what a text box is and invisible is?
Do you know how to use code to place a value in an unbound text box?
 
M

michael

Duane,

That was it. I now know a little more. Thanks a bunch for the help!

michael

Duane Hookom said:
Add a text box "txtBarCode" to your form and set its visible property to No.
Then add a line of code after you set stBarCode
Me.txtBarCode = stBarCode
Then, in your report you can add a text box with a control source of
something like:

=Forms!frmYourFormName!txtBarCode

--
Duane Hookom
MS Access MVP
--

michael said:
Duane,
Sorry for the delay, I could not the forum reloaded.
The OnClick is: (sorry so long)

Private Sub cmdPrintLaserBadge_Click()
On Error GoTo Err_cmdPrintLaserBadge_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim stQuote As String
Dim stRegName1 As String
Dim stRegName2 As String
Dim stStartBadge As String
Dim stSpace As String
Dim stCRLF As String
Dim stEndLine As String
Dim stEndBadge As String
Dim stBarcode As String
stQuote = Chr(34)
stStartBadge = Chr(2) & Chr(2) & Chr(2)
stSpace = Chr(3)
stCRLF = Chr(13) & Chr(10)
stEndLine = Chr(3) & Chr(31) & stCRLF
stEndBadge = stCRLF & stCRLF & stCRLF & stCRLF & Chr(26)
stBarcode = stQuote & stStartBadge & Me.RegID & stEndLine &
Me.First_Name & stSpace & " " & stSpace & Me.Last_Name & stEndLine &
Me.Title
& stEndLine & Me.Company & stEndLine & Forms!Company!Address1 & stEndLine
&
Forms!Company!Address2 & stEndLine & Forms!Company!City & stSpace & ", " &
stSpace & Forms!Company!State & stSpace & " " & stSpace &
Forms!Company!Postal & stEndLine & Forms!Company!Country & stEndLine &
Forms!Company!Phone & stEndLine & Forms!Company!Fax & stEndLine & Me.Email
&
stEndLine & stEndBadge & stQuote

MsgBox stBarcode

If Forms!Company!Text82 = 0 Then
stDocName = "Labels Registrants on laser stock"
stLinkCriteria = "[RegID]=" & Me![RegID]
DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria
Me.Printed = True
Me.Number_Printed = Me.Number_Printed + 1
Else
MsgBox "Can't Print Badge there is a Payment Due!"
End If
Exit_cmdPrintLaserBadge_Click:
Exit Sub
Err_cmdPrintLaserBadge_Click:
MsgBox Err.Description
Resume Exit_cmdPrintLaserBadge_Click
End Sub
(the MsgBox is for my help only)

Yes on the TextBox, but No on invisible
No.
But, if I get pointed in the correct direction I should be able to figure
it
out.
( i am a former dbase/Fox programmer very former)
TIA,
michael

Duane Hookom said:
Could you share the OnClick code?
Do you know what a text box is and invisible is?
Do you know how to use code to place a value in an unbound text box?

--
Duane Hookom
MS Access MVP


Duane,

Thanks, that was fast! Again, newbie talking, but what do you mean by
invisible text box? The variable is declared in the OnClick of the
command
buttom. Can't I just use stBarCode in the ControlSource of the text box
on
the report?

tia,
michael

:

You could use an invisible text box to store the stBarCode. Then in
your
report, use:
=Forms!frmYourForm!txtBarCode
Otherwise, you could use a variable declared in the declarations
section
of
a standard module.

--
Duane Hookom
MS Access MVP


I apologise for being a newbie, but I have searched many a forum to
try
to
figure out how to pass a variable to a report. On one of my forms I
have
a
command button that creates a list of variables that I need to print
a
barcode (PDF417 2D), and then call the report to print. I need to
use
this
variable (stBarCode) in the report. I have an ActiveX Control ( to
use
the
PDF417 dll) to print the barcode. I can put in the ControlSource
any
of
the
fields available, but I need to print the stBarCode variable.

Any help would be a be GREAT.....

TIA,
michael
 
V

Venus

What if that form is not open?

Duane Hookom said:
Add a text box "txtBarCode" to your form and set its visible property to No.
Then add a line of code after you set stBarCode
Me.txtBarCode = stBarCode
Then, in your report you can add a text box with a control source of
something like:

=Forms!frmYourFormName!txtBarCode

--
Duane Hookom
MS Access MVP
--

michael said:
Duane,
Sorry for the delay, I could not the forum reloaded.
The OnClick is: (sorry so long)

Private Sub cmdPrintLaserBadge_Click()
On Error GoTo Err_cmdPrintLaserBadge_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim stQuote As String
Dim stRegName1 As String
Dim stRegName2 As String
Dim stStartBadge As String
Dim stSpace As String
Dim stCRLF As String
Dim stEndLine As String
Dim stEndBadge As String
Dim stBarcode As String
stQuote = Chr(34)
stStartBadge = Chr(2) & Chr(2) & Chr(2)
stSpace = Chr(3)
stCRLF = Chr(13) & Chr(10)
stEndLine = Chr(3) & Chr(31) & stCRLF
stEndBadge = stCRLF & stCRLF & stCRLF & stCRLF & Chr(26)
stBarcode = stQuote & stStartBadge & Me.RegID & stEndLine &
Me.First_Name & stSpace & " " & stSpace & Me.Last_Name & stEndLine &
Me.Title
& stEndLine & Me.Company & stEndLine & Forms!Company!Address1 & stEndLine
&
Forms!Company!Address2 & stEndLine & Forms!Company!City & stSpace & ", " &
stSpace & Forms!Company!State & stSpace & " " & stSpace &
Forms!Company!Postal & stEndLine & Forms!Company!Country & stEndLine &
Forms!Company!Phone & stEndLine & Forms!Company!Fax & stEndLine & Me.Email
&
stEndLine & stEndBadge & stQuote

MsgBox stBarcode

If Forms!Company!Text82 = 0 Then
stDocName = "Labels Registrants on laser stock"
stLinkCriteria = "[RegID]=" & Me![RegID]
DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria
Me.Printed = True
Me.Number_Printed = Me.Number_Printed + 1
Else
MsgBox "Can't Print Badge there is a Payment Due!"
End If
Exit_cmdPrintLaserBadge_Click:
Exit Sub
Err_cmdPrintLaserBadge_Click:
MsgBox Err.Description
Resume Exit_cmdPrintLaserBadge_Click
End Sub
(the MsgBox is for my help only)

Yes on the TextBox, but No on invisible
No.
But, if I get pointed in the correct direction I should be able to figure
it
out.
( i am a former dbase/Fox programmer very former)
TIA,
michael

Duane Hookom said:
Could you share the OnClick code?
Do you know what a text box is and invisible is?
Do you know how to use code to place a value in an unbound text box?

--
Duane Hookom
MS Access MVP


Duane,

Thanks, that was fast! Again, newbie talking, but what do you mean by
invisible text box? The variable is declared in the OnClick of the
command
buttom. Can't I just use stBarCode in the ControlSource of the text box
on
the report?

tia,
michael

:

You could use an invisible text box to store the stBarCode. Then in
your
report, use:
=Forms!frmYourForm!txtBarCode
Otherwise, you could use a variable declared in the declarations
section
of
a standard module.

--
Duane Hookom
MS Access MVP


I apologise for being a newbie, but I have searched many a forum to
try
to
figure out how to pass a variable to a report. On one of my forms I
have
a
command button that creates a list of variables that I need to print
a
barcode (PDF417 2D), and then call the report to print. I need to
use
this
variable (stBarCode) in the report. I have an ActiveX Control ( to
use
the
PDF417 dll) to print the barcode. I can put in the ControlSource
any
of
the
fields available, but I need to print the stBarCode variable.

Any help would be a be GREAT.....

TIA,
michael
 
D

Duane Hookom

Open it.

--
Duane Hookom
MS Access MVP


Venus said:
What if that form is not open?

Duane Hookom said:
Add a text box "txtBarCode" to your form and set its visible property to
No.
Then add a line of code after you set stBarCode
Me.txtBarCode = stBarCode
Then, in your report you can add a text box with a control source of
something like:

=Forms!frmYourFormName!txtBarCode

--
Duane Hookom
MS Access MVP
--

michael said:
Duane,
Sorry for the delay, I could not the forum reloaded.
The OnClick is: (sorry so long)

Private Sub cmdPrintLaserBadge_Click()
On Error GoTo Err_cmdPrintLaserBadge_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim stQuote As String
Dim stRegName1 As String
Dim stRegName2 As String
Dim stStartBadge As String
Dim stSpace As String
Dim stCRLF As String
Dim stEndLine As String
Dim stEndBadge As String
Dim stBarcode As String
stQuote = Chr(34)
stStartBadge = Chr(2) & Chr(2) & Chr(2)
stSpace = Chr(3)
stCRLF = Chr(13) & Chr(10)
stEndLine = Chr(3) & Chr(31) & stCRLF
stEndBadge = stCRLF & stCRLF & stCRLF & stCRLF & Chr(26)
stBarcode = stQuote & stStartBadge & Me.RegID & stEndLine &
Me.First_Name & stSpace & " " & stSpace & Me.Last_Name & stEndLine &
Me.Title
& stEndLine & Me.Company & stEndLine & Forms!Company!Address1 &
stEndLine
&
Forms!Company!Address2 & stEndLine & Forms!Company!City & stSpace & ",
" &
stSpace & Forms!Company!State & stSpace & " " & stSpace &
Forms!Company!Postal & stEndLine & Forms!Company!Country & stEndLine &
Forms!Company!Phone & stEndLine & Forms!Company!Fax & stEndLine &
Me.Email
&
stEndLine & stEndBadge & stQuote

MsgBox stBarcode

If Forms!Company!Text82 = 0 Then
stDocName = "Labels Registrants on laser stock"
stLinkCriteria = "[RegID]=" & Me![RegID]
DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria
Me.Printed = True
Me.Number_Printed = Me.Number_Printed + 1
Else
MsgBox "Can't Print Badge there is a Payment Due!"
End If
Exit_cmdPrintLaserBadge_Click:
Exit Sub
Err_cmdPrintLaserBadge_Click:
MsgBox Err.Description
Resume Exit_cmdPrintLaserBadge_Click
End Sub
(the MsgBox is for my help only)

Yes on the TextBox, but No on invisible
No.
But, if I get pointed in the correct direction I should be able to
figure
it
out.
( i am a former dbase/Fox programmer very former)
TIA,
michael

:

Could you share the OnClick code?
Do you know what a text box is and invisible is?
Do you know how to use code to place a value in an unbound text box?

--
Duane Hookom
MS Access MVP


Duane,

Thanks, that was fast! Again, newbie talking, but what do you mean
by
invisible text box? The variable is declared in the OnClick of the
command
buttom. Can't I just use stBarCode in the ControlSource of the text
box
on
the report?

tia,
michael

:

You could use an invisible text box to store the stBarCode. Then in
your
report, use:
=Forms!frmYourForm!txtBarCode
Otherwise, you could use a variable declared in the declarations
section
of
a standard module.

--
Duane Hookom
MS Access MVP


I apologise for being a newbie, but I have searched many a forum
to
try
to
figure out how to pass a variable to a report. On one of my
forms I
have
a
command button that creates a list of variables that I need to
print
a
barcode (PDF417 2D), and then call the report to print. I need
to
use
this
variable (stBarCode) in the report. I have an ActiveX Control
( to
use
the
PDF417 dll) to print the barcode. I can put in the ControlSource
any
of
the
fields available, but I need to print the stBarCode variable.

Any help would be a be GREAT.....

TIA,
michael
 

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