Access Form Update Query

J

jdeno1

Is it possible to use and update query to edit a field in a table
based on a combobox value selected on a form? The specifics of what
I'm trying to accomplish are...

I want the user to be able to make a selection from a combobox and
have it update to a table.

I only want it to update where [t.jobdata]![Job Code] = [Forms]!
[cbo_primaryJob]

does that make sense? I can write a query that displays the data in
the combbox but I can't seem to get the update query to work. It
displays null when I run it.

So the query is...

UPDATE t_jobCodeStats_MAIN SET t_jobCodeStats_MAIN.[Primary Job] =
[Forms]![frm_JobCodeStats_MAIN]![cbo_Pjob1]
WHERE (((t_jobCodeStats_MAIN.JobCode)=[Forms]![frm_JobCodeStats_MAIN]!
[cbo_jobcode1]));

Help!

Thanks,

James
 
J

John W. Vinson

Is it possible to use and update query to edit a field in a table
based on a combobox value selected on a form? The specifics of what
I'm trying to accomplish are...

I want the user to be able to make a selection from a combobox and
have it update to a table.

I only want it to update where [t.jobdata]![Job Code] = [Forms]!
[cbo_primaryJob]

does that make sense? I can write a query that displays the data in
the combbox but I can't seem to get the update query to work. It
displays null when I run it.

So the query is...

UPDATE t_jobCodeStats_MAIN SET t_jobCodeStats_MAIN.[Primary Job] =
[Forms]![frm_JobCodeStats_MAIN]![cbo_Pjob1]
WHERE (((t_jobCodeStats_MAIN.JobCode)=[Forms]![frm_JobCodeStats_MAIN]!
[cbo_jobcode1]));

What error are you getting? The only problems I can see are if the Bound
Column of the two combo boxes doesn't match the value in t_jobcodeStats_MAIN.
 
J

jdeno1

Is it possible to use and update query to edit a field in a table
based on a combobox value selected on a  form?  The specifics of what
I'm trying to accomplish are...
I want the user to be able to make a selection from a combobox and
have it update to a table.
I only want it to update where [t.jobdata]![Job Code] = [Forms]!
[cbo_primaryJob]
does that make sense?   I can write a query that displays the data in
the combbox but I can't seem to get the update query to work.  It
displays null when I run it.
So the query is...
UPDATE t_jobCodeStats_MAIN SET t_jobCodeStats_MAIN.[Primary Job] =
[Forms]![frm_JobCodeStats_MAIN]![cbo_Pjob1]
WHERE (((t_jobCodeStats_MAIN.JobCode)=[Forms]![frm_JobCodeStats_MAIN]!
[cbo_jobcode1]));

What error are you getting? The only problems I can see are if the Bound
Column of the two combo boxes doesn't match the value in t_jobcodeStats_MAIN.
--

             John W. Vinson [MVP]- Hide quoted text -

- Show quoted text -

Thanks for the reply... The query returns blank or null when I run
it. The combobox's are queries that are filtered based on another
combobox selection. Would having hiding column in the combobox cause
it to appear blank/null? The column count is set to 5 and width is
set to: 0";0";1";0";0"
 
J

John W. Vinson

Is it possible to use and update query to edit a field in a table
based on a combobox value selected on a form? The specifics of what
I'm trying to accomplish are...

I want the user to be able to make a selection from a combobox and
have it update to a table.

I only want it to update where [t.jobdata]![Job Code] = [Forms]!
[cbo_primaryJob]

does that make sense? I can write a query that displays the data in
the combbox but I can't seem to get the update query to work. It
displays null when I run it.

So the query is...

UPDATE t_jobCodeStats_MAIN SET t_jobCodeStats_MAIN.[Primary Job] =
[Forms]![frm_JobCodeStats_MAIN]![cbo_Pjob1]
WHERE (((t_jobCodeStats_MAIN.JobCode)=[Forms]![frm_JobCodeStats_MAIN]!
[cbo_jobcode1]));

It should't make any difference if the combo is visible or not. The code as
written will attempt to insert the value in the Bound Column of cbo_Pjob1 -
are you certain that you're setting the right column? Maybe step through the
code and see what the Value of each combo box is.
 

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

Top