Hello..It's been a while since I've worked in Access and I'm just getting back into it. I'm having a problem getting information to update back into my table from a form. I can get the first record to work fine but subsequent records seem to get the data but will not update into the table. Any help anyone can provide me would be much appreciated.
Private Sub Command16_Click()
Dim db As Database
Set db = CurrentDb()
Dim rst As Recordset, rst1 As Recordset
Set rst = db.OpenRecordset("WM241BASD_IDCASE11")
Dim var As Variant
Dim var1 As Variant
var = Me.PalletID & " "
rst.MoveFirst
Do While Not rst.EOF
var1 = rst("IDCASN")
If var = var1 Then
Set rst1 = db.OpenRecordset("table1")
rst1.Edit
rst1("PalletID") = rst("IDCASN")
rst1("SKU") = rst("IDSTYL")
rst1("Location") = rst("IDZONE") & rst("IDAISL") & rst("IDBAY") & rst("IDLEVL") & rst("IDPOSN")
rst1("DateConsumed") = rst("IDDLM")
rst1("Qty") = rst("IDQTY")
rst1("Color") = rst("IDCOLR")
rst1("DateBuilt") = rst("IDDCR")
rst1.Update
Exit Do
Else
rst.MoveNext
End If
Loop
MsgBox "Update Complete"
Me.Refresh
End Sub
Private Sub Command16_Click()
Dim db As Database
Set db = CurrentDb()
Dim rst As Recordset, rst1 As Recordset
Set rst = db.OpenRecordset("WM241BASD_IDCASE11")
Dim var As Variant
Dim var1 As Variant
var = Me.PalletID & " "
rst.MoveFirst
Do While Not rst.EOF
var1 = rst("IDCASN")
If var = var1 Then
Set rst1 = db.OpenRecordset("table1")
rst1.Edit
rst1("PalletID") = rst("IDCASN")
rst1("SKU") = rst("IDSTYL")
rst1("Location") = rst("IDZONE") & rst("IDAISL") & rst("IDBAY") & rst("IDLEVL") & rst("IDPOSN")
rst1("DateConsumed") = rst("IDDLM")
rst1("Qty") = rst("IDQTY")
rst1("Color") = rst("IDCOLR")
rst1("DateBuilt") = rst("IDDCR")
rst1.Update
Exit Do
Else
rst.MoveNext
End If
Loop
MsgBox "Update Complete"
Me.Refresh
End Sub