G
Guest
Hi there,
I am not an ACCESS expert so I may easily have an error in here.
I am trying to update a field based on criteria. The funtion is being called
just fine and according to my msgbox's it is getting the correct info and
making the sql statement correctly (to my knowledge) but it is not updating
the field. I am guessing it is the string within a string part. Here is a
copy of the sql statement with a few added spaces to see what is what a bit
easier:
stSQL = "UPDATE [tbl Phase ID] SET [tbl Phase ID].[Production Started] =
True WHERE [tbl Phase ID].[Job] = ' " & ProjectID & " ' AND [tbl Phase
ID].[Phase] = ' " & SPID & " ';"
Below is the entire function which i am calling
---------------------------------------------------------------------------------------------
Public Function UpdateProductionStatus(ProjectID As String, PhaseID As String)
Dim stSQL As String
Dim SPID As String ' Shortened Phase ID
SPID = Mid(PhaseID, 1, 3)
MsgBox (SPID)
MsgBox (ProjectID)
stSQL = "UPDATE [tbl Phase ID] SET [tbl Phase ID].[Production Started] =
True WHERE [tbl Phase ID].[Job] = '" & ProjectID & "' AND [tbl Phase
ID].[Phase] = '" & SPID & "';"
MsgBox (stSQL)
DoCmd.RunSQL (stSQL)
MsgBox ("Action Done!")
End Functio
I am not an ACCESS expert so I may easily have an error in here.
I am trying to update a field based on criteria. The funtion is being called
just fine and according to my msgbox's it is getting the correct info and
making the sql statement correctly (to my knowledge) but it is not updating
the field. I am guessing it is the string within a string part. Here is a
copy of the sql statement with a few added spaces to see what is what a bit
easier:
stSQL = "UPDATE [tbl Phase ID] SET [tbl Phase ID].[Production Started] =
True WHERE [tbl Phase ID].[Job] = ' " & ProjectID & " ' AND [tbl Phase
ID].[Phase] = ' " & SPID & " ';"
Below is the entire function which i am calling
---------------------------------------------------------------------------------------------
Public Function UpdateProductionStatus(ProjectID As String, PhaseID As String)
Dim stSQL As String
Dim SPID As String ' Shortened Phase ID
SPID = Mid(PhaseID, 1, 3)
MsgBox (SPID)
MsgBox (ProjectID)
stSQL = "UPDATE [tbl Phase ID] SET [tbl Phase ID].[Production Started] =
True WHERE [tbl Phase ID].[Job] = '" & ProjectID & "' AND [tbl Phase
ID].[Phase] = '" & SPID & "';"
MsgBox (stSQL)
DoCmd.RunSQL (stSQL)
MsgBox ("Action Done!")
End Functio