Cancel InputBox

kingesk
09-14-2001, 10:02 AM
I'm using an InputBox to Update one optional field in a table. I'm wondering if I can capture vbYes or vbCancel just as I would with a msgBox. If they decide not to enter anything and click cancel the database is updated (over written) with
nothing instead of leaving the previous value.



Private Sub mnuDescription_Click()

Dim strFindCheckNumber As String
strFindCheckNumber = InputBox("Enter Check Number.")

Dim strInDescription As String

Dim pconDesc As New ADODB.Connection
Dim pcmdDesc As New ADODB.Command
Dim mRstCurrentDesc As New ADODB.Recordset

pconDesc.Mode = adModeShareDenyNone
pconDesc.CursorLocation = adUseClient
pconDesc.Provider = "Microsoft.jet.oledb.4.0"
pconDesc.ConnectionString = _
"Persist security Info=False;" & _
"Data Source=" & App.Path & "\PARS-Main.mdb" '& "\\HDRServer4\software\Pars\PARS-DB.mdb"
pconDesc.Open

Set pcmdDesc.ActiveConnection = pconDesc
pcmdDesc.CommandType = adCmdText
pcmdDesc.CommandText = "Select fldCheckNum, fldClientNum, fldDescription From tblDEpositedCheckDetails Where fldCheckNum = '" & _
strFindCheckNumber & "' AND IsNull(fldDepositBatchNum)"

mRstCurrentDesc.LockType = adLockOptimistic
mRstCurrentDesc.CursorLocation = adUseClient
mRstCurrentDesc.CursorType = adOpenKeyset
mRstCurrentDesc.Open pcmdDesc
MsgBox mRstCurrentDesc.RecordCount


'***********Code below in question
strInDescription = InputBox("Check Number: " & mRstCurrentDesc("fldCheckNum") & _
vbCrLf & "Client Number: " & mRstCurrentDesc("fldClientNum") & _
vbCrLf & "Current Description: " & mRstCurrentDesc("fldDescription") & _
vbCrLf & vbCrLf & _
"Enter New Description:")

mRstCurrentDesc("fldDescription") = strInDescription & ""
mRstCurrentDesc.Update

End Sub

Thinker
09-14-2001, 10:12 AM
I think therefore I am... sometimes right. images/icons/wink.gif

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum