Full Version: ComboBox within a Continous form
UtterAccess Forums > Microsoft® Access > Access Forms
favor08
Can you have a Continuous form and have one combo box update each record with in that form?
ight now I have a continuous form that shows all the field items for particular months and the comments inputted by the supervisors. I want the manager to select his name from the combo box and once he does this the main table will update the control source “Final Signoff” with his name. Then I would create a report off of this information.
Right now when I try to do this it only updates one record.
Oposted this yesterday but I am still am having trouble figuring this out. So I wanted to see if anyone knew of any other ways to do this.
Jack Cowley
You can only do what you want with code or with an update query. It will probably be easier for you to create an update query... Use the basic query you use now to filter the records, change it to an Update Query, in the Update To line of the correct column enter something like:
Forms]![NameOfYourForm]![NameOfComboBoxWithSupervisorID]
Then code similar to this in your command button:
DoCmd.SetWarnings False
DoCmd.OpenQuery "NameOfUpdateQuery"
DoCmd.SetWarnings True
This should get you started. Be sure to test your update query on a backup copy of your table so that you do not bugger your data.
For more details on update queries search Access help and Google....
hth,
Jack
TFSerwin
Mnn... just quick note on executing a query; passing on a tip from some others here at UA.
nstead of the Do.Cmd method of running a saved query (or a query stored as a string), which requires turning off and on the warning messages, you can use the following command.
CurrentDb.Execute "YourQuery" , dbFailOnError
Same thing, less code. grin.gif
Jack Cowley
Steve -
xcellent selection! Thank you for your input and catching me on my lapse....
Jack
TFSerwin
No worries, Jack... you may have been one of the ones who taught me the technique originally! grin.gif
Jack Cowley
Steve -
No worries". Generally an Australian expression. An Aussie living in Arizona maybe or just something you picked up in your travels? I'm just curious, but no response is required...
Thanks again!
Jack
TFSerwin
No, I'm an Arizona native....
..but, maybe.... I have a brand new Aussie cousin-in-law whom I met about a month ago who must have rubbed off on me during the wedding? Didn't really notice myself saying it until now... and certanily typing it is a step beyond weird.
Always wanted to go, though. Probably a good sign that I should check it out, hmm? laugh.gif
Jack Cowley
Steve -
love Arizona. Not the the big cities but smaller towns like Prescott and the thriving metropolis of Jerome. I suppose that Prescott is now a huge place but a long time ago, when I was there, it was not. Over a half century ago my school (jr. college) played Chandler in football. I think you won...but that was all before your time... By the way, I love those Aussies, if you hadn't guessed... They are a fun lot... And stick with 'no worries'...
Jack
favor08
what command button are you referring to
Jack Cowley
A command button that you would add to your form that the user clicks after the selection is made from the combo box...
favor08
I did this nothing happened when I clicked the button
Jack Cowley
Did you create code or an update query to add the data to your table? Are you sure the code or query does what you want? Did you get any errors?
ack
favor08
I created and update query. I don't think i am doing this right.
Jack Cowley
Search Access help for Update Queries as there is some help there. Use Google to search for creating update queries in Access and you will probably find some help there as well.
ack
favor08
Now it says too few paramters expected 1
Jack Cowley
If you run your update query directly do you get this error? Where is your criteria coming from?
favor08
No I don't get this error when I just run the update query.
This what the update query says.
Field: FinalSignoff
Table: QOutstandingRpt
Dbs2!FinalSignoff
Update to: Dbs2!FinalSignoff
Criteria ([Forms]![FrmOutstandingRpt]![Sgnoff])
I am using the query that Record Source for the form to make the update query.
Jack Cowley
What is Dbs2!FinalSignoff? You need two columns in your query, one to filter to the correct record and then the Update To field. Your queries SQL might look like this:
PDATE QOutstandingRpt SET QOutstandingRpt.FinalSignOff = [Forms]![FrmOutstandingRpt]![Sgnoff]
WHERE (((QOutstandingRpt.Supervisor)=[Forms]![FrmOutstandingRpt]![ControlWithPrimaryKe
y]));
Jack
favor08
DB2 is the name of the table and FinalSignoff is the field where the signature is to go.
o I want to say in the when "mngrName" is picked from "ComboBox" runupdate query and update the field "final Signoff" with "mngrName"
Jack Cowley
CurrentDB.Execute "UPDATE DB2 SET DB2.FinalSignOff = [Forms]![FrmOutstandingRpt]![Sgnoff]
WHERE DB2.Supervisor=[Forms]![FrmOutstandingRpt]![ControlWithPrimaryKey];"
This is as close as I can come to writing the code for you. If this is not exact then you are going to have to spend some time experimenting so you can learn how to do these types of things.
Good luck!!!
Jack
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.