andyrohith
New member
- Local time
- Today, 06:50
- Joined
- Oct 18, 2009
- Messages
- 5
Hai All,
I am doing a barcode generator program in access and process is in the form i have a text box where i can enter an item number and the barcode is generated in a report.Now the criteria is ,suppose if the item number i entered has 5 pieces then it must write same 5 barcodes in the report.This is my code
Private Sub Command4_Click()
Dim Counter As Integer
Dim Temp As Integer
If DCount("*", "Table1", "Field1 like '*" & Me.itnumber & "*'") = 0 Then
'no records, display message
MsgBox "There are no records that meet your search criteria"
Me.itnumber.SetFocus
Temp = Quanlity
Exit Sub
Else
Counter = 0
Do While (Counter <= Temp)
DoCmd.RunSQL ("INSERT INTO table2 ([Number]) VALUES (itnumber)")
Counter = Counter + 1
Loop
End If
If (Counter > Temp) Then
DoCmd.OpenReport "Hadabah", acViewPreview, , "Number like '*" & Me.itnumber & "*'"
End If
End Sub
The technique iam using is to get the item number from Table1 and insert in another table named Table2 with respect to the quantity.And then get it in the report.But iam getting them only once in the report.I know there's some problem in loop structure.Pls help with this iam new to vb.
Thanks,
Andrew....
I am doing a barcode generator program in access and process is in the form i have a text box where i can enter an item number and the barcode is generated in a report.Now the criteria is ,suppose if the item number i entered has 5 pieces then it must write same 5 barcodes in the report.This is my code
Private Sub Command4_Click()
Dim Counter As Integer
Dim Temp As Integer
If DCount("*", "Table1", "Field1 like '*" & Me.itnumber & "*'") = 0 Then
'no records, display message
MsgBox "There are no records that meet your search criteria"
Me.itnumber.SetFocus
Temp = Quanlity
Exit Sub
Else
Counter = 0
Do While (Counter <= Temp)
DoCmd.RunSQL ("INSERT INTO table2 ([Number]) VALUES (itnumber)")
Counter = Counter + 1
Loop
End If
If (Counter > Temp) Then
DoCmd.OpenReport "Hadabah", acViewPreview, , "Number like '*" & Me.itnumber & "*'"
End If
End Sub
The technique iam using is to get the item number from Table1 and insert in another table named Table2 with respect to the quantity.And then get it in the report.But iam getting them only once in the report.I know there's some problem in loop structure.Pls help with this iam new to vb.
Thanks,
Andrew....