Copy Row in Access - TechRepublic
Question
October 8, 2009 at 05:10 AM
b_evans

Copy Row in Access

by b_evans . Updated 16 years, 9 months ago

Hi,
I have a database that tracks our companies serial numbers. Many times our assemblers take out a bunch of serial numbers at a time, but were kinda lacking in the tracking of those numbers. I currently have a database that copies a row and automatically fills in data. The fields are Serial, LensPrf, txtPerson, Lens, Dates. The serial is auto filed with an unbound text field and all the others the user inputs. My issues is my SQL works with all inputs except txtPerson and I can’t figure out why. All fields are filled from a form. My code is below. Any help would be appreciated!

Private Sub Command8_Click()
Dim i As Integer
Dim lngSN As Long
Dim strSQL As String

lngSN = Me.LastSN

For i = 1 To Me.Copies
lngSN = Me.LastSN + i
strSQL = “INSERT INTO tblSerial (Serial, txtPerson, Lensprf, Lens, Dates) ” & _
“Values (” & lngSN & “, ” & Me.txtPersoninput & “, ” & Me.Lnsprf & “, ” & Me.Lensinput & “, #” & Me.Dateinput & “#);”

CurrentDb.Execute strSQL
Next i
End Sub

This discussion is locked

All Comments