Append Query problem

aner1755

Registered User.
Local time
Today, 22:20
Joined
Jan 23, 2009
Messages
43
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
 
Can you post the SQL for the append query AppendAttendenceQ?
 
Here it comes;

INSERT INTO AttendanceT ( StundentID, InClass, AttendanceDate )
SELECT StudentT.StudentID, StudentT.TempAttendance, [Forms]![StudentT]![AttendanceDate] AS TodaysDate
FROM StudentT;


Can you see anything in the code that causes the problem?
As I mentioned, when I execute this "manualy" (not by the created button) it works fine. Bybe its a problem with some setting that affects macros...?
 
Hi HiTechCoach!
I discovred a type-O negative... A misspelled formed caused the problem.
I'm sorry for starting this thread, guess I got blind and since I'm pretty freash at Access I thought I needed some giudence...
Thanks for your time anyway.
 
Hi HiTechCoach!
I discovred a type-O negative... A misspelled formed caused the problem.
I'm sorry for starting this thread, guess I got blind and since I'm pretty freash at Access I thought I needed some giudence...
Thanks for your time anyway.

Hate it when that happens. :D

Glad you got it working!.

Good luck with your project ...
 

Users who are viewing this thread

Back
Top Bottom