L
liora
I have 2 table: "t_qun_loc", "t-trans"
field of t_qun_loc: "lotnum" as string
"hnum" as long
"location" as string
"total quantity" as double
field of t-trans:"lotnum" as string
"hnum" as long
"location" as string
"qun" as double
"upddate" as date
"t-trans index-primary key:lotnum,hnum,location
I need to update the "qun" and "upddate" fields in table
t-trans - for each match record from t_qun_loc I wrote
this:
---------------------------------------
Public Sub Updatetrans()
Dim db As Database
Dim r As DAO.Recordset
Dim t As DAO.Recordset
Dim r2 As DAO.Recordset
Dim Msg As String
Dim x As Integer
Dim Criteria As String
Set db = CurrentDb
Set r = db.OpenRecordset("t_qun_loc", DB_OPEN_TABLE)
Set t = db.OpenRecordset("t-trans", DB_OPEN_TABLE)
While Not r.EOF
t.Index = "primarykey"
t.Seek "=", r!LOTnum, CLng(r!HNUM), r!Location
If Not t.NoMatch Then
t.Edit
t![qun] = r![total quantity]
t![upddate] = Now()
t.Update
r.Delete
End If
r.MoveNext
Wend
End Sub
---------------------------------------------
I recieved an error while I run it:
"data type convertion error" on the t.seek line
Can anybody explain me??
liora
field of t_qun_loc: "lotnum" as string
"hnum" as long
"location" as string
"total quantity" as double
field of t-trans:"lotnum" as string
"hnum" as long
"location" as string
"qun" as double
"upddate" as date
"t-trans index-primary key:lotnum,hnum,location
I need to update the "qun" and "upddate" fields in table
t-trans - for each match record from t_qun_loc I wrote
this:
---------------------------------------
Public Sub Updatetrans()
Dim db As Database
Dim r As DAO.Recordset
Dim t As DAO.Recordset
Dim r2 As DAO.Recordset
Dim Msg As String
Dim x As Integer
Dim Criteria As String
Set db = CurrentDb
Set r = db.OpenRecordset("t_qun_loc", DB_OPEN_TABLE)
Set t = db.OpenRecordset("t-trans", DB_OPEN_TABLE)
While Not r.EOF
t.Index = "primarykey"
t.Seek "=", r!LOTnum, CLng(r!HNUM), r!Location
If Not t.NoMatch Then
t.Edit
t![qun] = r![total quantity]
t![upddate] = Now()
t.Update
r.Delete
End If
r.MoveNext
Wend
End Sub
---------------------------------------------
I recieved an error while I run it:
"data type convertion error" on the t.seek line
Can anybody explain me??
liora