K
Kamil
Hi.
Is it possible to add new record to my recordset which is based on a
query?
I want to use this recordset only for temp starage of data, and I
don't want to update values from this recordset to a table.
Code:
Q2 = "SELECT T_SMP_RCNR.KEY_ORDER, T_SMP_RCNR.RCNR,
T_SMP_RCNR.KEY_RCNR " & _
"FROM T_SMP_RCNR LEFT JOIN Q_MaxOfSMPRCNR ON
T_SMP_RCNR.KEY_ORDER = Q_MaxOfSMPRCNR.KEY_ORDER " & _
"WHERE T_SMP_RCNR.RCNR = [MaxOfSMPRCNR];"
rstQ2.Open Q2, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
[...]
rstQ2.Find "KEY_ORDER LIKE '" & keyOrd & "'"
If rstQ2.EOF Then
new_RCNR = 1
rstQ2.AddNew
rstQ2!key_order = keyOrd
rstQ2!RCNR = 1
rstQ2!key_rcnr = keyOrd & "." & new_RCNR
rstQ2.Update
MsgBox rstQ2!key_rcnr
Else
new_RCNR = rstQ2!RCNR + 1
rstQ2!RCNR = new_RCNR
rstQ2!key_rcnr = keyRcnr
End If
If it's not possible (or senseless) - then what different option can I
choose?
thanks for help,
best regards,
Kamil
Is it possible to add new record to my recordset which is based on a
query?
I want to use this recordset only for temp starage of data, and I
don't want to update values from this recordset to a table.
Code:
Q2 = "SELECT T_SMP_RCNR.KEY_ORDER, T_SMP_RCNR.RCNR,
T_SMP_RCNR.KEY_RCNR " & _
"FROM T_SMP_RCNR LEFT JOIN Q_MaxOfSMPRCNR ON
T_SMP_RCNR.KEY_ORDER = Q_MaxOfSMPRCNR.KEY_ORDER " & _
"WHERE T_SMP_RCNR.RCNR = [MaxOfSMPRCNR];"
rstQ2.Open Q2, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
[...]
rstQ2.Find "KEY_ORDER LIKE '" & keyOrd & "'"
If rstQ2.EOF Then
new_RCNR = 1
rstQ2.AddNew
rstQ2!key_order = keyOrd
rstQ2!RCNR = 1
rstQ2!key_rcnr = keyOrd & "." & new_RCNR
rstQ2.Update
MsgBox rstQ2!key_rcnr
Else
new_RCNR = rstQ2!RCNR + 1
rstQ2!RCNR = new_RCNR
rstQ2!key_rcnr = keyRcnr
End If
If it's not possible (or senseless) - then what different option can I
choose?
thanks for help,
best regards,
Kamil