Hey guys.
This is my first proper thread to Access Forums after my introduction one so here goes!
I have a table in my database called (RiskForm1) and it has many fields in it one of which is called TotalImpact. Now I have some SQL/VBA code earlier in my project which inserts values into all my fields on my table from an excel spreadsheet, other than TotalImpact which is left empty (deliberately).
Now I have a text box on my form called TotalImpactText and then a button which once pressed should update the table with the value in the TotalImpactText box. This is done this way as it needs to be a manual value placed into the table after the rest of the records have been inputted into the table.
My question is, how do I go about updating the TotalImpact field in the table for the LAST record placed into the RiskForm1 table? Here is some code I already have:
Now obviously I need to set a WHERE statement otherwise every field in my table will become the value inside the textbox, so, is my code close at all to what I need? I feel im very close but just need a little guidance.
Any help is appreciated, thanks guys.
Jake
This is my first proper thread to Access Forums after my introduction one so here goes!
I have a table in my database called (RiskForm1) and it has many fields in it one of which is called TotalImpact. Now I have some SQL/VBA code earlier in my project which inserts values into all my fields on my table from an excel spreadsheet, other than TotalImpact which is left empty (deliberately).
Now I have a text box on my form called TotalImpactText and then a button which once pressed should update the table with the value in the TotalImpactText box. This is done this way as it needs to be a manual value placed into the table after the rest of the records have been inputted into the table.
My question is, how do I go about updating the TotalImpact field in the table for the LAST record placed into the RiskForm1 table? Here is some code I already have:
Code:
Private Sub ImportManual_Click()
Dim UpdateSQL As String
UpdateSQL = "UPDATE RiskForm1 SET " & _
"TotalImpact = !TotalImpactText.Text" & _
"WHERE TotalImpact = "
DoCmd.RunSQL UpdateSQL, dbFailOnError
Now obviously I need to set a WHERE statement otherwise every field in my table will become the value inside the textbox, so, is my code close at all to what I need? I feel im very close but just need a little guidance.
Any help is appreciated, thanks guys.
Jake