Hi all!
I have a problem regarding a Append Query. I’m using Access 2007 and have just played around with it 2 weeks by myself.
First I created a query that just appends two fields from one table to another. If I open the query in design-mode and execute it by the “Command Ribbon” it works fine. I got the expected result.
But when I try to automate the procedure a little by creating a Form with a Button where I’ve assign a embedded macro it halts. What happens is that I’m prompted the Query in Design-mode, and no edit of the table where I wish new row to be added. The macro states; Instruction: OpenQuery Argument; ExportQry;Datasheet;Edit I even tried to write some VBA code (see below), without luck. The same “error” occurs.
Hope someone know why this is?
Would by very grateful for replies.
Cheers!
Private Sub Kommandoknapp11_Click()
On Error GoTo Err_Kommandoknap8_Click
Dim stDocName As String
Me.Refresh
stDocName = "AppendAttendenceQ"
DoCmd.OpenQuery stDocName, acNormal, acEdit
MsgBox "Done!"
Exit_Kommandoknap8_Click:
Exit Sub
Err_Kommandoknap8_Click:
MsgBox Err.Description
Resume Exit_Kommandoknap8_Click
End Sub
I have a problem regarding a Append Query. I’m using Access 2007 and have just played around with it 2 weeks by myself.
First I created a query that just appends two fields from one table to another. If I open the query in design-mode and execute it by the “Command Ribbon” it works fine. I got the expected result.
But when I try to automate the procedure a little by creating a Form with a Button where I’ve assign a embedded macro it halts. What happens is that I’m prompted the Query in Design-mode, and no edit of the table where I wish new row to be added. The macro states; Instruction: OpenQuery Argument; ExportQry;Datasheet;Edit I even tried to write some VBA code (see below), without luck. The same “error” occurs.
Hope someone know why this is?
Would by very grateful for replies.
Cheers!
Private Sub Kommandoknapp11_Click()
On Error GoTo Err_Kommandoknap8_Click
Dim stDocName As String
Me.Refresh
stDocName = "AppendAttendenceQ"
DoCmd.OpenQuery stDocName, acNormal, acEdit
MsgBox "Done!"
Exit_Kommandoknap8_Click:
Exit Sub
Err_Kommandoknap8_Click:
MsgBox Err.Description
Resume Exit_Kommandoknap8_Click
End Sub