Trying to update a table with 16 potential textbox controls containing Short Times to show a patient's location. I'm getting no error messages and the UPDATE code seems to work, but only for certain controls, even though they are all formatted the exact same and the code's exactly the same for each UPDATE clause...
Thought maybe I'm trying to run too many UPDATE's at the same time, so I tried running just a few of them with no different result. Also tried running with Long Time formats but no change there either.
Any ideas why some fields would update but others wouldn't? (Or is there maybe a more elegant solution than what I've come up with to make this moot?)
Here's the code, I tagged which ones work and which don't... any ideas greatly appreciated...!
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' TRW ' WHERE Time = #" & Me.txtTRW.Value & "# And PtNum = " & Me.Pt.Value & ";"
'works
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' TR ' WHERE Time = #" & Me.txtTR.Value & "# And PtNum = " & Me.Pt.Value & ";"
'works
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' AMB ' WHERE Time = #" & Me.txtAMB.Value & "# And PtNum = " & Me.Pt.Value & ";"
'works
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' HOSP ' WHERE Time = #" & Me.txtHOSP.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' TxW ' WHERE Time = #" & Me.txtTxW.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' Tx ' WHERE Time = #" & Me.txtTx.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' XRW ' WHERE Time = #" & Me.txtXRW.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' XR ' WHERE Time = #" & Me.txtXR.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' CTW ' WHERE Time = #" & Me.txtCTW.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' CT ' WHERE Time = #" & Me.txtCT.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' ORW ' WHERE Time = #" & Me.txtORW.Value & "# And PtNum = " & Me.Pt.Value & ";"
'works
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' OR ' WHERE Time = #" & Me.txtOR.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' HA ' WHERE Time = #" & Me.txtHA.Value & "# And PtNum = " & Me.Pt.Value & ";"
'works
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' Civ ' WHERE Time = #" & Me.txtCiv.Value & "# And PtNum = " & Me.Pt.Value & ";"
'works
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' Exp ' WHERE Time = #" & Me.txtExp.Value & "# And PtNum = " & Me.Pt.Value & ";"
'works
Thought maybe I'm trying to run too many UPDATE's at the same time, so I tried running just a few of them with no different result. Also tried running with Long Time formats but no change there either.
Any ideas why some fields would update but others wouldn't? (Or is there maybe a more elegant solution than what I've come up with to make this moot?)
Here's the code, I tagged which ones work and which don't... any ideas greatly appreciated...!
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' TRW ' WHERE Time = #" & Me.txtTRW.Value & "# And PtNum = " & Me.Pt.Value & ";"
'works
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' TR ' WHERE Time = #" & Me.txtTR.Value & "# And PtNum = " & Me.Pt.Value & ";"
'works
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' AMB ' WHERE Time = #" & Me.txtAMB.Value & "# And PtNum = " & Me.Pt.Value & ";"
'works
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' HOSP ' WHERE Time = #" & Me.txtHOSP.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' TxW ' WHERE Time = #" & Me.txtTxW.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' Tx ' WHERE Time = #" & Me.txtTx.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' XRW ' WHERE Time = #" & Me.txtXRW.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' XR ' WHERE Time = #" & Me.txtXR.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' CTW ' WHERE Time = #" & Me.txtCTW.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' CT ' WHERE Time = #" & Me.txtCT.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' ORW ' WHERE Time = #" & Me.txtORW.Value & "# And PtNum = " & Me.Pt.Value & ";"
'works
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' OR ' WHERE Time = #" & Me.txtOR.Value & "# And PtNum = " & Me.Pt.Value & ";"
'doesn't work
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' HA ' WHERE Time = #" & Me.txtHA.Value & "# And PtNum = " & Me.Pt.Value & ";"
'works
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' Civ ' WHERE Time = #" & Me.txtCiv.Value & "# And PtNum = " & Me.Pt.Value & ";"
'works
DoCmd.RunSQL " UPDATE MASTERShell " _
& " SET Location = ' Exp ' WHERE Time = #" & Me.txtExp.Value & "# And PtNum = " & Me.Pt.Value & ";"
'works