B
Bill Phillips
I have a form based on a table. I need to edit a value in
the form insert into a different table then delete the
record. I can do all of this using the following code, but
after the code runs the fields of the form show #Deleted.
I have tried a variety of ways to requery the form, but I
keep getting errors.
Private Sub cmdAddRecord_Click()
Dim rs As New ADODB.Recordset
Dim oconn As ADODB.Connection
Dim dbstemp As Database
Set dbstemp = CurrentDb
Dim ItemLoc As String
Dim ItemID As String
Dim ItemQty As Long
Dim ItemScanDate As Date
Dim ItemScanTime As Date
Dim ItemUser As String
Dim strSql As String
Dim strSqlDel As String
ItemLoc = Me.txtNewLoc
ItemID = Me.Item
ItemQty = Me.Qty
ItemScanDate = Me.ScanDate
ItemScanTime = Me.ScanTime
ItemUser = Me.User
strSql = "INSERT into tblInvScanIn (Item, Loc, Qty,
ScanDate, ScanTime, User) values ('" & ItemID & "', '" &
ItemLoc & "', '" & ItemQty & "', '" & ItemScanDate
& "', '" & ItemScanTime & "', '" & ItemUser & "')"
dbstemp.Execute strSql
MsgBox "Record Added"
DoCmd.OpenQuery "qryNeedValidLocDel", acViewNormal,
acEdit
frmNeedValidLoc.Requery
DoCmd.GoToControl "txtNewLoc"
Me.txtNewLoc.Value = Null
End Sub
Any help is most appreciated.
the form insert into a different table then delete the
record. I can do all of this using the following code, but
after the code runs the fields of the form show #Deleted.
I have tried a variety of ways to requery the form, but I
keep getting errors.
Private Sub cmdAddRecord_Click()
Dim rs As New ADODB.Recordset
Dim oconn As ADODB.Connection
Dim dbstemp As Database
Set dbstemp = CurrentDb
Dim ItemLoc As String
Dim ItemID As String
Dim ItemQty As Long
Dim ItemScanDate As Date
Dim ItemScanTime As Date
Dim ItemUser As String
Dim strSql As String
Dim strSqlDel As String
ItemLoc = Me.txtNewLoc
ItemID = Me.Item
ItemQty = Me.Qty
ItemScanDate = Me.ScanDate
ItemScanTime = Me.ScanTime
ItemUser = Me.User
strSql = "INSERT into tblInvScanIn (Item, Loc, Qty,
ScanDate, ScanTime, User) values ('" & ItemID & "', '" &
ItemLoc & "', '" & ItemQty & "', '" & ItemScanDate
& "', '" & ItemScanTime & "', '" & ItemUser & "')"
dbstemp.Execute strSql
MsgBox "Record Added"
DoCmd.OpenQuery "qryNeedValidLocDel", acViewNormal,
acEdit
frmNeedValidLoc.Requery
DoCmd.GoToControl "txtNewLoc"
Me.txtNewLoc.Value = Null
End Sub
Any help is most appreciated.