Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inputbox value into a form 2

Status
Not open for further replies.

RBE

Programmer
May 25, 2000
72
US
How do I use the inputbox value entered in a form? I am trying to automatically fill in a field on a form becaues, the users seem to forget the product when they don't have to enter a batch. The product usually defaults to a value when a batch is entered but if they don't have a batch # then they often forget to enter the product too. Here is my code I can get the prompt to pop up but the value is not transfering to the product field. Thanks
RBE


Private Sub BATCH_LostFocus()
Dim answer As String
answer = InputBox("What is the product for this move?")
If [Batch] = Null Then
[Product] = answer
End If
End Sub

I have not tested this to see what it will do if there is a batch# in the batch field. This box may pop up all the time.


RBE


Are you 100% sure of where you are going.
 
The problem is in your if statement. One of the logic rules in VB is that nothing ever equals Null, not even another null.

Try this instead: If IsNull([Batch]) Then Maq B-)
<insert witty signature here>
 
Thanks, Still trying to figure out this VB stuff. Thanks again.
RBE RBE


Are you 100% sure of where you are going.
 
Hi!

If you don't want the input box to pop up when there is a value in batch, then put the answer = InputBox(etc.) inside the If statement. Then it will only pop up if Batch is null.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top