Delete Records

  • Thread starter Thread starter Nathan
  • Start date Start date
N

Nathan

I was Mistaken i need to delete a table in vb coding here
is the code:

sql = "INSERT INTO PAPS ( PapsLLLL, PapsAutoIncrement,
PapsZero, PapsFinalNumber, PapsFinalBar ) "
sql = sql & "SELECT '" & Forms!frmCompany!CompanyPaps
& "' AS Expr1, "
sql = sql & Forms!frmCompany!InitialPaps & " AS
Expr2, " & randomNumber & " AS Expr3, '"
sql = sql & Forms!frmCompany!CompanyPaps & space &
Right("000000" & Forms!frmCompany!InitialPaps, 6) & space
& randomNumber & "' AS Expr4, '"
sql = sql & Forms!frmCompany!CompanyPaps & Right
("000000" & Forms!frmCompany!InitialPaps, 6)
sql = sql & randomNumber & "' AS Expr6;"


****HERE IS WHERE I NEED THE TABLE CLEARED***

sql = "INSERT INTO PAPSBAR ( PapsLLLL,
PapsAutoIncrement, PapsZero, PapsFinalNumber,
PapsFinalBar ) "
sql = sql & "SELECT '" & Forms!frmCompany!CompanyPaps
& "' AS Expr1, "
sql = sql & Forms!frmCompany!InitialPaps & " AS
Expr2, " & randomNumber & " AS Expr3, '"
sql = sql & Forms!frmCompany!CompanyPaps & space &
Right("000000" & Forms!frmCompany!InitialPaps, 6) & space
& randomNumber & "' AS Expr4, '"
sql = sql & Forms!frmCompany!CompanyPaps & Right
("000000" & Forms!frmCompany!InitialPaps, 6)
sql = sql & randomNumber & "' AS Expr6;"
 
I was Mistaken i need to delete a table in vb coding here
is the code:

Whoa.

What are you trying to ACCOMPLISH here?

Neither of your SELECT statements will work, because you're not
selecting anything from any table - a SELECT clause in a Query
*requires* A FROM clause indicating which table or tables you're
selecting data *from*.

If you're trying to use an unbound form and populate a single record
into a table, use the Values() operator instead of s SELECT.
sql = "INSERT INTO PAPS ( PapsLLLL, PapsAutoIncrement,
PapsZero, PapsFinalNumber, PapsFinalBar ) "
sql = sql & "SELECT '" & Forms!frmCompany!CompanyPaps
& "' AS Expr1, "
sql = sql & Forms!frmCompany!InitialPaps & " AS
Expr2, " & randomNumber & " AS Expr3, '"
sql = sql & Forms!frmCompany!CompanyPaps & space &
Right("000000" & Forms!frmCompany!InitialPaps, 6) & space
& randomNumber & "' AS Expr4, '"
sql = sql & Forms!frmCompany!CompanyPaps & Right
("000000" & Forms!frmCompany!InitialPaps, 6)
sql = sql & randomNumber & "' AS Expr6;"


****HERE IS WHERE I NEED THE TABLE CLEARED***

Your subject line says "delete records". Your line above says "delete
table". What do you want deleted? Why?
 
Back
Top