Hi,
I have a form which user pulls in records.. I also have a button to where the user can update the record.. This works fine as long as there is something being updated..
The problem is When i pull the record and say I want to delete whatever is in the field leaving it blank. then update it to have a blank field. That doesnt work.. When i clear out the field and hit update.. it says its updated but.. i go into my table and the field that I try to leave empty is still there.. I can update it as long as there is something replaced.. but if I leave it blank.. then it doesnt update...
heres the code
thanks for the help
I have a form which user pulls in records.. I also have a button to where the user can update the record.. This works fine as long as there is something being updated..
The problem is When i pull the record and say I want to delete whatever is in the field leaving it blank. then update it to have a blank field. That doesnt work.. When i clear out the field and hit update.. it says its updated but.. i go into my table and the field that I try to leave empty is still there.. I can update it as long as there is something replaced.. but if I leave it blank.. then it doesnt update...
heres the code
Code:
Private Sub Command27_Click()
Dim f1 As String
Dim f2 As String
Dim f3 As String
Dim strsql As String
Select Case MsgBox("Are you sure you would like to UPDATE?" & vbCrLf & vbLf & " Yes: Updates Record" & vbCrLf & " No: Does NOT Update Record" & vbCrLf & " Cancel: Reset (Undo) Changes" & vbCrLf, vbYesNoCancel + vbQuestion, "Clicking UPDATE will ERASE all old information!")
Case vbYes: 'Updates the changes
ControlNo.SetFocus
f1 = ControlNo.Text
strProject.SetFocus
f2 = strProject.Text
strArea.SetFocus
f3 = strArea.Text
strsql = "UPDATE * WHERE tblQR.ControlNo = '" & f1 & "'"
CurrentDb.Execute strsql
Case vbNo: 'Do not delete or undo
'Do nothing
Case vbCancel: 'Undo the changes
DoCmd.RunCommand acCmdUndo
Me.tbProperSave.Value = "No"
Case Else: 'Default case to trap any errors
'Do nothing
End Select
End Sub
thanks for the help