Inputbox ok only

  • Thread starter Thread starter meyerryang
  • Start date Start date
M

meyerryang

I want to clean up the prompt, because the "cancel" button is confusing to
some Users. Is there a way to get rid of the cancel button in the same way
that you would with a message box with vbokonly? If so, how???

inputbox("Please enter note and click OK.","") ???
 
Sure, just design your own input form calling it with an openargs (if you
are passing it a value), like
here we are passing a default amount -"amt":

DoCmd.openform "frmInputAmount", , , , , acDialog, amt
astring = MyVar1
'two variables here,one local (astring) and
'the other (MyVar1) global

DoCmd.Close acForm, "frmInputAmount"
MyVar1 = ""
...........and whatever code you need to process with astring.


Private Sub Form_Load() This opens your input form-- "frmInputAmount" in
this example

If Not IsNull(Me.OpenArgs) Then
Me.txtInput.DefaultValue = Me.OpenArgs
End If
end sub


Private Sub cmdClose_Click() This is the "OK" or Close button for your input
form
MyVar1 = Me.txtInput 'this is the input box.and the global variable gets its
value
'to use on the main form...
Me.Visible = False
End Sub

I am sure you can adapt this to your own needs. Getting rid of a cancel
button, however,
requires that you make sure there is some code that catches errors the user
may make.


Damon
 
Back
Top