update query from subform on navigation form (1 Viewer)

robina

Access Developer
Local time
Yesterday, 17:29
Joined
Feb 28, 2012
Messages
102
I have a navigation form, a navigation subform, and then a subform. When I click the save button on the navigation subform, i need the data entered in two fields on the subform to save in a table. the subform is based on a query. This is what I currently have on the the button's onClick event:
Code:
Update data_tbl
  Set [data_tbl].[Approved] = [Forms]![Navigationfrm]![Navigation subform].Form![Entry_subfrm].[Form]![CboAppd]
  [data_tbl].[Comments] = [Forms]![Navigationfrm]![Navigation subform].Form![Entry_subfrm].[Form]![txtComments]
  WHERE [data_tbl].[ID] = [Forms]![Navigationfrm]![Navigation subform].Form![Entry_subfrm].[Form]![ID]

I've searched everywhere. thank you.
 

JHB

Have been here a while
Local time
Today, 02:29
Joined
Jun 17, 2012
Messages
7,732
What is the problem, do you get any error message?
One thing I see, that you are missing a "," between the 2 fields you are trying to update.
Code:
Update data_tbl   
Set [data_tbl].[Approved] = [Forms]![Navigationfrm]![Navigation subform].Form![Entry_subfrm].[Form]![CboAppd][SIZE=4][B][COLOR=Red],[/COLOR][/B][/SIZE]
[data_tbl].[Comments] = [Forms]![Navigationfrm]![Navigation subform].Form![Entry_subfrm].[Form]![txtComments]   
WHERE [data_tbl].[ID] = [Forms]![Navigationfrm]![Navigation subform].Form![Entry_subfrm].[Form]![ID]
 

robina

Access Developer
Local time
Yesterday, 17:29
Joined
Feb 28, 2012
Messages
102
I would get a message stating that every record would be updated. I've since then been able to have the input on the subform automatically save to the data_tbl by using the table in the query for the form. This made the controls bound. I would still appreciate knowing the correct syntax. You stated above that a comma was missing. Is that all? thank you.
 

JHB

Have been here a while
Local time
Today, 02:29
Joined
Jun 17, 2012
Messages
7,732
... I would still appreciate knowing the correct syntax. You stated above that a comma was missing. Is that all? thank you.
The comma has to be in there to separate the fields - (like it has to be in a Select query).
 

Users who are viewing this thread

Top Bottom