D
Dave
I have a tempory table to which a lit of part number are pasted from Excel.
I need to validate these numbers for being Known or New parts
I have the following code that finds "New" part numbers and inserts them in
the "tblnewparts" table - this works fine.
I can't find a way of inserting the "Known" records in to tblxfileboms" then
deleting all records from the tempory table.
Can any one help??
Dave
Private Sub btnvalidate_Click()
On Error Resume Next
Dim rsTarget As DAO.Recordset
Dim rsSource As DAO.Recordset
Dim strSQL As String
Dim Cancel As Boolean
Set rsSource = CurrentDb.OpenRecordset("tbltemp")
Set rsTarget = CurrentDb.OpenRecordset("tblnewparts")
If Not rsSource.BOF Then
Do Until rsSource.EOF
If IsNull(DLookup("[IZPN]", "tblpartsdatabase", "[IZPN] = '" &
rsSource("partno") & "'")) Then
If MsgBox("This is a New Part - Do You Wish To Add?",
vbYesNo, "Project Costing Database") = vbNo Then
' do nothing
Else
rsTarget.AddNew
rsTarget("xfile") = rsSource("xfile")
rsTarget("issue") = rsSource("issue")
rsTarget("partno") = rsSource("partno")
rsTarget("qty") = rsSource("qty")
rsTarget.Update
End If
End If
rsSource.MoveNext
Loop
End If
rsTarget.Close
rsSource.Close
Set rsTarget = Nothing
Set rsSource = Nothing
End Sub
I need to validate these numbers for being Known or New parts
I have the following code that finds "New" part numbers and inserts them in
the "tblnewparts" table - this works fine.
I can't find a way of inserting the "Known" records in to tblxfileboms" then
deleting all records from the tempory table.
Can any one help??
Dave
Private Sub btnvalidate_Click()
On Error Resume Next
Dim rsTarget As DAO.Recordset
Dim rsSource As DAO.Recordset
Dim strSQL As String
Dim Cancel As Boolean
Set rsSource = CurrentDb.OpenRecordset("tbltemp")
Set rsTarget = CurrentDb.OpenRecordset("tblnewparts")
If Not rsSource.BOF Then
Do Until rsSource.EOF
If IsNull(DLookup("[IZPN]", "tblpartsdatabase", "[IZPN] = '" &
rsSource("partno") & "'")) Then
If MsgBox("This is a New Part - Do You Wish To Add?",
vbYesNo, "Project Costing Database") = vbNo Then
' do nothing
Else
rsTarget.AddNew
rsTarget("xfile") = rsSource("xfile")
rsTarget("issue") = rsSource("issue")
rsTarget("partno") = rsSource("partno")
rsTarget("qty") = rsSource("qty")
rsTarget.Update
End If
End If
rsSource.MoveNext
Loop
End If
rsTarget.Close
rsSource.Close
Set rsTarget = Nothing
Set rsSource = Nothing
End Sub