Re: What is wrong with this?
Remove the * from the below line.
vb Code:
sql = "delete * from whoishere where userid = " & ComboBox1.Text & ""
Re: What is wrong with this?
Still a Data Mismatch error
Re: What is wrong with this?
shouldn't that be
"delete from whoishere where userid = '" & ComboBox1.text & "'"
Re: What is wrong with this?
Yep Thanks a million!!
Any clue how to move the record to another table before I delete it?
Re: What is wrong with this?
you should be able to do something like this, but i haven't tried it at all
vb Code:
"insert into othertable (select * from whoishere whereuserid = '" & ComboBox1.text & "'")"
Re: What is wrong with this?
It doesnt seem to work
Code:
Dim con As New ADODB.Connection
Dim con_string As String
Dim sql As String
Dim sql1 As String
Dim rs As New ADODB.Recordset
con_string = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\Documents and Settings\leightr\My Documents\culverflex.mdb;"
con.Open(con_string)
sql1 = "insert into archive (select * from whoishere whereuserid = '" & ComboBox1.text & "'")"
sql = "delete from whoishere where userid = '" & TextBox1.Text & "'"
rs = con.Execute(sql)
Re: What is wrong with this?
Okay I got it working with the following... the only problem is now the delete will now work!! But if I remove the move sql the delete will work.
Code:
Dim con As New ADODB.Connection
Dim con_string As String
Dim move As String
Dim Sql As String
Dim rs As New ADODB.Recordset
con_string = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\Documents and Settings\leightr\My Documents\culverflex.mdb;"
con.Open(con_string)
move = "INSERT INTO archive SELECT * FROM Whoishere WHERE userid = '" & TextBox1.Text & "'"
Sql = "delete from whoishere where userid = '" & TextBox1.Text & "'"
rs = con.Execute(move, Sql)
Re: What is wrong with this?
Okay.. I figured it out (again) I am not sure if this is the correct way of doing what I am doing.. but it works! I thought I would post the correct code.. maybe someone can re-write it the correct way?
Code:
Dim con As New ADODB.Connection
Dim con_string As String
Dim move As String
Dim del As String
Dim rs As New ADODB.Recordset
Dim rss As New ADODB.Recordset
con_string = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\Documents and Settings\leightr\My Documents\culverflex.mdb;"
con.Open(con_string)
move = "INSERT INTO archive SELECT * FROM whoishere WHERE userid = '" & TextBox.Text & "'"
del = "DELETE * FROM whoishere WHERE userid = '" & TextBox.Text & "'"
rs = con.Execute(move)
del = "DELETE * FROM whoishere WHERE userid = '" & TextBox.Text & "'"
rss = con.Execute(del)
Re: What is wrong with this?
Quote:
move = "INSERT INTO archive SELECT * FROM whoishere WHERE userid = '" & TextBox.Text & "'"
del = "DELETE * FROM whoishere WHERE userid = '" & TextBox.Text & "'"
rs = con.Execute(move)
del = "DELETE * FROM whoishere WHERE userid = '" & TextBox.Text & "'"
rss = con.Execute(del)
you don't need the del = twice,other than that looks ok
as it works, all is good
Re: What is wrong with this?
lol. Opps I guess I forgot to remove the first del