Hi,
I want to be able to copy a selection of table1 to table2 where a specific field in table1 equals value of inputbox.
I have got the following code, but get an error on [Competitors].MoveFirst
Tables are "Competitors" and "Result Search"
I want to be able to copy a selection of table1 to table2 where a specific field in table1 equals value of inputbox.
I have got the following code, but get an error on [Competitors].MoveFirst
Tables are "Competitors" and "Result Search"
Code:
Private Sub cmdBernArt_Click()
Dim Message As String
Dim tab1 As Recordset
Dim db As Database
Set db = CurrentDb
Dim sql As String
Message = InputBox("Enter BernerArticle")
sql = "INSERT INTO [Result Search] * " & _
"SELECT * " & _
"FROM [Competitors] " & _
"WHERE [Competitors].[BernerArtNr] = '" & Message & "';"
[Competitors].MoveFirst
Do While Not [Competitors].EOF
DoCmd.RunSQL sql
[Competitors].MoveNext
Loop
End Sub