Append data to another table with a filter

Ben_Entrew

Registered User.
Local time
Today, 08:28
Joined
Dec 3, 2013
Messages
177
Hi all,
I want to append data to the FC_TEMP table with the condition that the time_period is same on FC_TEMP and Scrap_Sales_Forecast table.

Somehow it asks me to type in a parameter for Time_Period on FC_TEMP.
Can someone please help me here?
Thanks in advance.

Regards,
Ben

Code:
'Append Scrap Sales forecast to actual FC_TEMP table

Public Sub Append_Scrap()
DoCmd.RunSQL "INSERT INTO [FC_TEMP] SELECT Scrap_Sales_Forecast.* FROM Scrap_Sales_Forecast " & _
             " WHERE FC_TEMP.[Time_Period] = Scrap_Sales_Forecast.[Time_Period]"
End Sub
 
I've changed the query, still it doesn't append anything to FC_TEMP.
This time I assign a value to the Time_Period variable in Scrap_Sales_Forecast table.

Code:
'Append Scrap Sales forecast to actual FC_TEMP table

Public Sub Append_Scrap()
DoCmd.RunSQL "INSERT INTO [FC_TEMP] SELECT Scrap_Sales_Forecast.* FROM Scrap_Sales_Forecast " & _
             " WHERE Scrap_Sales_Forecast.[Time_Period] = '" & timeperiod & "'"
End Sub
 
What data type is field [Time_Period] in the Scrap_Sales_Forecast table?
Is it text type type, (because your criteria is text value)?
What is the value of timeperiod?
Try to run the query in the QBE-window, it think it will clear something up.

To your post #1, mostly the error message your get, points to a wrong spelt field/table name.
 
Now it works. Reason was a false Time_Period value.

Thanks to all.
 

Users who are viewing this thread

Back
Top Bottom