Click to See Complete Forum and Search --> : Which is correct? SOLVED
Bazzlad
Jul 1st, 2003, 03:34 AM
For a blank text box....which is the correct way?
blah blah on click
if
A) text6.value = false
B) text6.value = Null
C) text6.value = 0
then
Etc
A B or C?
or is there another?
alex_read
Jul 1st, 2003, 04:35 AM
I think generally the preferred way is to set the text property to a blank string, null does not mean the same thing...
Text1.Text = ""
Bazzlad
Jul 1st, 2003, 04:58 AM
that wont work for reasons...which i should have explained!!! doh!
the text box itself is hidden and takes its value from a combobox
and you can't reference a property unless it has the focus
opus
Jul 1st, 2003, 06:44 AM
Hi, alex
he asked the same in the general section.
on the original question your suggestion was correct (Check for =""), but he had other problems too...........
I tried to help for some length, but ...
alex_read
Jul 1st, 2003, 06:51 AM
Okay thank Opus ;) , Bazzlad - you're gonna have to paste a sample up please mate - I can't re-create any problems trying this at the moment...
:confused: :eek:
Bazzlad
Jul 1st, 2003, 07:00 AM
At work so can't put things up however
http://www.vbforums.com/showthread.php?s=&threadid=251711
this explains it....
it comes down to the correct way of making a multiple if statement, and if a blank text box can be tested on .value = false
Thanx for helping :D
alex_read
Jul 1st, 2003, 07:01 AM
Got it, ahh you're playing with Access too, fine I'll take a quick look...
alex_read
Jul 1st, 2003, 07:15 AM
ahh okay looks like I was wrong - you can't use the text property in this case...
http://www.tek-tips.com/gviewthread.cfm/lev2/4/lev3/27/pid/705/qid/418638
This one seems to work for me:
Bazzlad
Jul 1st, 2003, 07:22 AM
Thanks Alex,
I read your post just as I figured it...
Private Sub Command8_Click()
On Error GoTo Err_Command8_Click
If Text6.Value = False Then
responce = MsgBox("Enter a Customer Name", vbOKOnly, "You messed up!")
Else
GoTo 10
Exit Sub
10
If IMEI.Value >= "" Then
GoTo 20
Else: responce = MsgBox("Enter an IMEI Number", vbOKOnly, "You messed up!")
Exit Sub
20
If Make.Value >= "" Then
GoTo 30
Else: responce = MsgBox("Enter an Phone Make", vbOKOnly, "You messed up!")
Exit Sub
30
Dim stDocName As String
Dim stLinkCriteria As String
Me.Visible = False
stDocName = "frmrepair"
DoCmd.OpenForm stDocName, , , stLinkCriteria
stDocName = "frmrepair"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
[Forms]![frmrepair]![Text14] = [Forms]![frmphone]![IMEI]
[Forms]![frmrepair]![Customer Name] = [Forms]![frmphone]![Text6]
[Forms]![frmrepair]![Check25] = [Forms]![frmphone]![Warranty]
End If
End If
End If
Exit_Command8_Click:
Exit Sub
Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click
End Sub
What I don't get is why I have to make text6.value = false
and the others .value >= ""
and if I try to swap them round they won't work, but I'm not complaining! It works!
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.