Input Data From Message Box

fatbloater

Registered User.
Local time
Today, 11:44
Joined
Sep 28, 2004
Messages
36
I have a button, when the user clicks this button i want an 'OK' (only option is OK) message box with a title of Name to pop up that says 'Please enter name'. Then when they press the OK button what they have typed is saved to a text box called 'name'. I would like to make it impossible for them to leave it null. Can any body help ... thanks in advance.
 
Make your own message box with a form a textBox and an OK button. Then put the code OnClick of the OK button to transfer what they have typed to the Name field of the original form.

Incidentally I wouldn't call a TextBox "Name" or "Date" etc as these are reserved words in Access and can cause problems ;)

Col
 
Dont Want To, Just Want An Input Box That Will Not Let You Have Null And Will Stay There Until You Enter Text.
 
inpu box function

The best way you can dot his is to use the InputBox function to define a variable, and loop the user round if that leave it blank or hit the cancel button


DIM myname AS string

InputBox:
myname = InputBox("This is my inputbox", "TITLE", "DEFAULT TEXT")

If Nz(myname, "") = "" Then
MsgBox "You must insert a value"
GoTo InputBox

Else
MsgBox myname
End If​

then you have their value as the variable MYNAME, which you can use as you wish
 

Users who are viewing this thread

Back
Top Bottom