What is VBa code to create a message box with an input box with two buttons (OK and Cancel).
What is the code that uses the value of the input box (on click OK) to search the tblCLIENT for the URN?
MsgBox and InputBox are two different things. Which one do you really want? VBA Help has guidance on these intrinsic functions. Validating user entry in InputBox can be tricky. Here is an example of one from my db:
Code:
strRDC = IIf(strMode = "Draft", "X", "?")
While strRDC = "?"
strRDC = InputBox("Enter report distribution code:" & vbCrLf & vbCrLf & _
" D1 Highway Construction" & vbCrLf & vbCrLf & _
" D2 Preconstruction" & vbCrLf & vbCrLf & _
" D3 HAP/ACP Mix Designs" & vbCrLf & vbCrLf & _
" D4 Northern Region" & vbCrLf & vbCrLf & _
" D5 Southeast Region" & vbCrLf & vbCrLf & _
" D6 Accepted Products" & vbCrLf & vbCrLf & _
" D7 M&O Central Region" & vbCrLf & vbCrLf & _
" D8 Special" & vbCrLf & vbCrLf & _
" D9 Aviation Construction" & vbCrLf & vbCrLf & _
" D10 Concrete Mix" & vbCrLf & vbCrLf & _
" D11 AIA Field Maintenance" & vbCrLf & vbCrLf & _
" N Number File" & vbCrLf & vbCrLf & _
" X Copy not for distribution nor filing", "Distribution", "X")
If UCase(strRDC) Like "D[1-9]" Or UCase(strRDC) Like "D1[0-1]" Or UCase(strRDC) = "N" Or UCase(strRDC) = "X" Then
'continue with report print
ElseIf strRDC <> "" Then
MsgBox "Not an appropriate entry.", vbApplicationModal, "Entry Error"
strRDC = "?"
Else
GoTo Exit_proc
End If
Wend
What is the code to return a message box "found" OR "Not found"
Maybe you want something like:
If IsNull(DLookup("ID", "tblClient", "URN='" & InputBox("Enter URN to search") & "'")) Then
MsgBox "URN Not Found", vbOKOnly
Else
MsgBox "URN Found", vbOKOnly
End If
I really don't know what you mean by 'standard code'. There are methods and vocabulary and syntax and these are applied as needed for the specific situation. There is always more than one way to accomplish a requirement.