Label printing with multiple values vba

Lucky008

New Member
Joined
Aug 17, 2021
Messages
1
Hello everyone
Im trying to learn more about Access Database and I'm an beginner so please forgive me.

I've made a database for storing orders and print labels thorugh a report for every order I put to organize the little shoe shop.
Usually the order is made creating a table with custom fields.

Table1:
Art - Model - Color - 35 - 36 - 37 - 38 - 39 - 40 - 41 - 42

I add fields thorugh a mask i've made and the output is made on the table for single order.
ex.

DataLav - MB040 - Stiletto Shoes - Black - 35[1] 36[2] 37[1] 38[1] 39[0] 40[1] 41[0] 42[0]

To output print labels I made a report with the size of template of the printing sheet for my printer.
I should output print labels this way once the data of single order field is called (DataLav)

MB040 - Stiletto Shoes - Black N. 35
MB040 - Stiletto Shoes - Black N. 36
MB040 - Stiletto Shoes - Black N. 36
MB040 - Stiletto Shoes - Black N. 37
MB040 - Stiletto Shoes - Black N. 38
MB040 - Stiletto Shoes - Black N. 40

I actually able to get the data for Articles, model and color as are stastic field and output correctly for the date I put in report.
But how i can get the dynamical field for numbers? How i can print on the report the same label for the quantity indicated?
Actually my out put is:

MB040 - Stiletto Shoes - Black N. //
MB040 - Stiletto Shoes - Black N. //
MB040 - Stiletto Shoes - Black N. //
MB040 - Stiletto Shoes - Black N. //

I tried something with VBA doing a Do while

VBA Code:
Private Sub Size_Click()
'On Error GoTo ErrHandler

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim rstFiltered As DAO.Recordset
Dim number As String

Set dbs = CurrentDb

Set rst = dbs.OpenRecordset (_ "SELECT 35, 36, 37, 38, 39, 40, 41, 42 FROM Table1 WHERE (((Table1.[DataLav])=[Add your date:]));")

If rst.EOF And rst.BOF Then
    MsgBox "There are no records in the recordset."
Else
     Do While Not rst.EOF
        number = rst!
        For Each rst In .Fields
        Me.Size.Value = rst.Value
        Else
        MsgBox "There are no field."
End If
rst.Close
Set rst = Nothing

End Sub

"Size" is the label name of the report field "35>42"
Actually I need put this macro on the report opening to generate the correct output.

But this dont work, could you help me?
I will appreciate
thank you
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,214,621
Messages
6,120,568
Members
448,972
Latest member
Shantanu2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top