Need some help, in the following code i want a input box to pop up and request the user enter a valuee that will replace a previous one (amending). Currently after a press "ok" on the inputbox it askes me for the parameter value of the value i typed into the inputbox (not the variable). i dotn know what is the problem, can anybody help me out?
Code:
Private Sub CmdAmend_Click()
On Error GoTo Err_CmdAmend_Click
Dim strAmendNew As Variant
Dim strAmendOld As String
Dim PosId As Integer
Dim strSQL As String
Dim ErrMsg As String
Dim SuccessMsg As String
Dim NullCheck As String
PosId = Me.List3.Value
strAmendOld = DLookup("[Position]", "Positions", "[ID] = " & PosId)
strAmendNew = InputBox("Enter New Data", "Position Amend", strAmendOld)
If IsNull(strAmendNew) = True Then
ErrMsg = MsgBox("You did not enter a value!", vbOKOnly, "Error!")
Else
If IsNull(strAmendNew) = False Then
strSQL = "UPDATE Positions SET Position = " & strAmendNew & " WHERE ID = " & PosId & ";"
DoCmd.RunSQL strSQL
SuccessMsg = MsgBox("Amendment Successful", vbOKOnly, "Success!")
Me.List3.Requery
Else
ErrMsg = MsgBox("Something went wrong!", vbOKOnly, "Could not complete request")
End If
End If