Update multi-select control to table

  • Follow


Access 2007 on Vista 

I am using a form to set variables for the creation of a report.  One of the 
controls is a multi-select combo box.  There is a table which stores the 
choices from the form and provides the Record Source for the report.  
Following the completion of the choices in the multi-select combo box and 
clicking on the OK button at the bottom of the control, focus moves to 
another control.  I have determined that the table does not immediately 
update the multi-value selections to the table, but does so correctly when 
the form is closed.  Exiting the form and returning to generate the report is 
not a satisfactory solution.  I want to use the After Update event of the 
multi-select control, or even another control to do an immediate update of 
the table, but can’t get the code right.  I am getting:
       
    Run Time Error ‘13’   type mismatch

...but have rigorously sought the mismatch without success. The bound values 
in the multi-select combo are text values concatenated as csv’s (Comma 
Separated Values) for storage in the Record Source table.

The code I am currently using (and failing with) is:

    'Now write/update the task selections to the underlying table 
"TaskHoursData"
         sqlTaskChoices = "UPDATE TaskHoursData _
        SET TaskHoursData.TasksForReport = '" & Me!cboRequiredTasks _
         "' WHERE TaskHoursData.JobID = " & Me!cboJobSite & ";"
        
         DoCmd.RunSQL (sqlTaskChoices)

Any guidance as to the fix for this code or another way to achieve this 
immediate update?  
     
Thanks as Always  ....Justin
0
Reply Utf 1/13/2010 4:07:01 PM

This was a repeat post in error. Functioning answer was posted to 1/12/2010 
question "Update multiselect fields in table with code". Answer no longer 
required.

Thanks to all readers.  

"The Grape Hunter" wrote:

> Access 2007 on Vista 
> 
> I am using a form to set variables for the creation of a report.  One of the 
> controls is a multi-select combo box.  There is a table which stores the 
> choices from the form and provides the Record Source for the report.  
> Following the completion of the choices in the multi-select combo box and 
> clicking on the OK button at the bottom of the control, focus moves to 
> another control.  I have determined that the table does not immediately 
> update the multi-value selections to the table, but does so correctly when 
> the form is closed.  Exiting the form and returning to generate the report is 
> not a satisfactory solution.  I want to use the After Update event of the 
> multi-select control, or even another control to do an immediate update of 
> the table, but can’t get the code right.  I am getting:
>        
>     Run Time Error ‘13’   type mismatch
> 
> ..but have rigorously sought the mismatch without success. The bound values 
> in the multi-select combo are text values concatenated as csv’s (Comma 
> Separated Values) for storage in the Record Source table.
> 
> The code I am currently using (and failing with) is:
> 
>     'Now write/update the task selections to the underlying table 
> "TaskHoursData"
>          sqlTaskChoices = "UPDATE TaskHoursData _
>         SET TaskHoursData.TasksForReport = '" & Me!cboRequiredTasks _
>          "' WHERE TaskHoursData.JobID = " & Me!cboJobSite & ";"
>         
>          DoCmd.RunSQL (sqlTaskChoices)
> 
> Any guidance as to the fix for this code or another way to achieve this 
> immediate update?  
>      
> Thanks as Always  ....Justin
0
Reply Utf 1/13/2010 9:07:02 PM


1 Replies
175 Views

(page loaded in 0.065 seconds)


Reply: