psbsmms
Programmer
- Dec 14, 2001
- 74
I have a master item table that i am tryong to set up a listbox that once selected all the items would be moved to a new table with all the fields of the master table. What i am currently doing is copying the master table with a new name to get the structure and then deleteing the items within the table. I can get the copy going with the new name, but when I run the delete sql it deletes the master table not the copy here is the code.
Private Sub Command4_Click()
Dim strTableName As String
Dim strSQL As String
Stop
If IsNull(strTableName = CmbCustomer.Column(1)) Then
MsgBox "You have not selected a customer, Select correct Customer and Try again", vbOKOnly
Exit Sub
End If
strTableName = CmbCustomer.Column(1)
strTableName = "tbl" & strTableName
DoCmd.CopyObject , strTableName, acTable, "tblitems"
strSQL = "DELETE *.* FROM [" & strTableName & "]"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
End Sub
Private Sub Command4_Click()
Dim strTableName As String
Dim strSQL As String
Stop
If IsNull(strTableName = CmbCustomer.Column(1)) Then
MsgBox "You have not selected a customer, Select correct Customer and Try again", vbOKOnly
Exit Sub
End If
strTableName = CmbCustomer.Column(1)
strTableName = "tbl" & strTableName
DoCmd.CopyObject , strTableName, acTable, "tblitems"
strSQL = "DELETE *.* FROM [" & strTableName & "]"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
End Sub