update query help

G

Guest

I want to update information from "Sheet1" to "department". The fields I want
to copy from and to are both called "rate" and I want to match "EmployeeID"
(the same in each table). Here is my SQL:

UPDATE Department
SET [Department]![Rate] = [forms]![sheet1]![rate]
WHERE ([forms]![sheet1]![employeeID]=[Department]![EmployeeID]);

I get an "Enter Parameter Value" box for "forms!sheet1!rate". Not too sure
what is going on. Is my SQL correct?
 
G

Guest

The where condition should be the other way around

UPDATE Department
SET [Department]![Rate] = [forms]![sheet1]![rate]
WHERE [Department]![EmployeeID]=[forms]![sheet1]![employeeID]

Check again if the names of the form and the field are correct
The Form need to be open when this SQL runs
If Sheet1 is a subform, the path need to be different

[forms]![MainFormName]![SubFormControlName].Form![employeeID]
 
G

Guest

Hello Ofer,

Thanks for the reply.

"Sheet1" is a temporary table which I will delete and "Department" is a
subform but I didn't realise it would make a difference.

My SQL maybe a bit more complicated than I thought.

Ofer Cohen said:
The where condition should be the other way around

UPDATE Department
SET [Department]![Rate] = [forms]![sheet1]![rate]
WHERE [Department]![EmployeeID]=[forms]![sheet1]![employeeID]

Check again if the names of the form and the field are correct
The Form need to be open when this SQL runs
If Sheet1 is a subform, the path need to be different

[forms]![MainFormName]![SubFormControlName].Form![employeeID]
--
Good Luck
BS"D


scubadiver said:
I want to update information from "Sheet1" to "department". The fields I want
to copy from and to are both called "rate" and I want to match "EmployeeID"
(the same in each table). Here is my SQL:

UPDATE Department
SET [Department]![Rate] = [forms]![sheet1]![rate]
WHERE ([forms]![sheet1]![employeeID]=[Department]![EmployeeID]);

I get an "Enter Parameter Value" box for "forms!sheet1!rate". Not too sure
what is going on. Is my SQL correct?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top