Printing current record to a label

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hi there,

We have a table with customers and I would like to have a button that prints
a label of the current customer.

I have got so far that printing works to labels but how do i limit it to
just the current record?

Txs in advance
Michael

PS: for the labelprinting i use a report that prints to a specific printer
(i.e. a labelprinter)
 
Michael,

You will need to add a Where Condition to the OpenReport method. Something
like the following:

Dim strCriteria As String

' This works when your matching field is text
strCriteria = "[CustID] = " & Chr(34) & Me!CustID & Chr(34)
DoCmd.OpenReport "MyReport", acViewNormal, , strCriteria

' This works when your matching field is a number
strCriteria = "[CustID] = " & Me!CustID
DoCmd.OpenReport "MyReport", acViewNormal, , strCriteria

hth,
 
Txs Cheryl,

Mucho appriciado

Michael

Cheryl Fischer said:
Michael,

You will need to add a Where Condition to the OpenReport method. Something
like the following:

Dim strCriteria As String

' This works when your matching field is text
strCriteria = "[CustID] = " & Chr(34) & Me!CustID & Chr(34)
DoCmd.OpenReport "MyReport", acViewNormal, , strCriteria

' This works when your matching field is a number
strCriteria = "[CustID] = " & Me!CustID
DoCmd.OpenReport "MyReport", acViewNormal, , strCriteria

hth,
--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Michael said:
Hi there,

We have a table with customers and I would like to have a button that prints
a label of the current customer.

I have got so far that printing works to labels but how do i limit it to
just the current record?

Txs in advance
Michael

PS: for the labelprinting i use a report that prints to a specific printer
(i.e. a labelprinter)
 
de nada!

--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Phoenix said:
Txs Cheryl,

Mucho appriciado

Michael

Cheryl Fischer said:
Michael,

You will need to add a Where Condition to the OpenReport method. Something
like the following:

Dim strCriteria As String

' This works when your matching field is text
strCriteria = "[CustID] = " & Chr(34) & Me!CustID & Chr(34)
DoCmd.OpenReport "MyReport", acViewNormal, , strCriteria

' This works when your matching field is a number
strCriteria = "[CustID] = " & Me!CustID
DoCmd.OpenReport "MyReport", acViewNormal, , strCriteria

hth,
--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Michael said:
Hi there,

We have a table with customers and I would like to have a button that prints
a label of the current customer.

I have got so far that printing works to labels but how do i limit it to
just the current record?

Txs in advance
Michael

PS: for the labelprinting i use a report that prints to a specific printer
(i.e. a labelprinter)
 
Back
Top