Append Query error

khurram7x

Registered User.
Local time
Today, 13:38
Joined
Mar 4, 2015
Messages
226
I've created an Append Action Query. When I run the Query when form "[Forms]![frmBoQ_Entry_Edit]"is opened and there's already a record, it executes correct and adds required records in sub form/table. But when i use the same query for a new record, which is basically what i want, in an After Update event in a parent form using CurrentDB.Execute, it shows me Run-time error '3061': Too few parameters. Expected 1.

What little about debugging i know, i tried to no avail.

Below is a the query, but I'm also attaching the related part of the database for anybody willing to help please.

Thanks

INSERT INTO tblBoQ_Progress ( BoQID, Step, Activity )
SELECT tblBoQ.ID, tblROC_Activities_Steps.Step, tblROC_Activities_Steps.Activity
FROM (tblROC_InstallationType INNER JOIN tblROC_Activities_Steps ON tblROC_InstallationType.ID = tblROC_Activities_Steps.InstallationTypeID) INNER JOIN tblBoQ ON tblROC_InstallationType.ID = tblBoQ.InstallationTypeID
WHERE (((tblROC_Activities_Steps.InstallationTypeID)=[Forms]![frmBoQ_Entry_Edit]![InstallationTypeID]));
 

Attachments

My guess would be that Access can't get a value for:
=[Forms]![frmBoQ_Entry_Edit]![InstallationTypeID]));
The form would need to be open for this to work
 
@khurram7x

Don't use AWF as a crutch, but rather as support. Error 3061 is quite popular, handled here and elsewhere a million times, and you can easily google a solution (.Execute has no clue about Access forms and controls, which is why this fails).
 
Perhaps what you need is something like:
Code:
    CurrentDb.Execute "INSERT INTO tblBoQ_Progress ( BoQID, Step, Activity )SELECT tblBoQ.ID, tblROC_Activities_Steps.Step, tblROC_Activities_Steps.Activity FROM (tblROC_InstallationType INNER JOIN tblROC_Activities_Steps ON tblROC_InstallationType.ID = tblROC_Activities_Steps.InstallationTypeID) INNER JOIN tblBoQ ON tblROC_InstallationType.ID = tblBoQ.InstallationTypeID WHERE (((tblROC_Activities_Steps.InstallationTypeID)=[COLOR="Red"] " & [/COLOR]Me.InstallationTypeID [COLOR="red"]& "[/COLOR]))"
 
my guess would be that as a new record, you haven't actually saved it before running the query
 
Perhaps what you need is something like:
Code:
     CurrentDb.Execute "INSERT INTO tblBoQ_Progress ( BoQID, Step, Activity  )SELECT tblBoQ.ID, tblROC_Activities_Steps.Step,  tblROC_Activities_Steps.Activity FROM (tblROC_InstallationType INNER  JOIN tblROC_Activities_Steps ON tblROC_InstallationType.ID =  tblROC_Activities_Steps.InstallationTypeID) INNER JOIN tblBoQ ON  tblROC_InstallationType.ID = tblBoQ.InstallationTypeID WHERE  (((tblROC_Activities_Steps.InstallationTypeID)=[COLOR=Red] " & [/COLOR]Me.InstallationTypeID [COLOR=red]& "[/COLOR]))"
Thanks Bob, it worked.

my guess would be that as a new record, you haven't actually saved it before running the query
CJ, I'm running this query in After Update event. So it should do the thing.

@khurram7x
Don't use AWF as a crutch, but rather as support. Error 3061 is quite popular, handled here and elsewhere a million times, and you can easily google a solution (.Execute has no clue about Access forms and controls, which is why this fails).
Spikepl, please be assure that every time i post a question i spend a considerable amount of time searching over the internet and I spend well above half day looking for this and apply different solutions. But you see my problem here was different, it was a syntax error in WHERE clause where I had a mistake (though i tried different variants including Me.FieldName thing, but i did not post each variant of query I tried in original question) and I could not get this with the kindof error message i was getting. I'm living in a place where there's no institute or teacher who could help me learn Databases, no help whatsoever, except forums... I'm learning everything from books and there's is no answer in books when you face an issue. Thank you for your understanding.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom