I am trying to edit the following code to be able to require the user to enter a Loan number and keep prompting the user to enter a value as long as the field is blank. Once the field is filled in, then the code should go on to check if the sql condition is met and make the necessary change if met, then finally, I have a save command code that will require the user to save the record. Right now I am getting errors when I added the code to require the user to enter a field. I am new to loop and if statements in vba so I am not exactly sure how to structure it. Thanks for you help.
Code:
Private Sub Save_Record_Click()
Dim SQL As String
Do
If IsNull(Me![Loan Number]) Then MsgBox "Please Enter Loan Number. This is a required field."
End If
Loop Until (Me![Loan Number]) = .Value
SQL = "Update Investor_Request set Status = 'Closed' where Loan_Number = " & Me![Loan Number] & _
" AND status = 'Outstanding'"
CurrentDb.Execute SQL, dbFailOnError
On Error GoTo Err_Save_Record_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_Save_Record_Click:
Exit Sub
Err_Save_Record_Click:
MsgBox Err.Description
Resume Exit_Save_Record_Click
End Sub