|
-
Apr 8th, 2002, 11:18 PM
#1
Thread Starter
New Member
"Or" Operator problem
This is my code:
Private Sub cmdAdd_Click()
If rs2.NoMatch Then
If txtAuthor.Text = " " Or txtName.Text = " " Or txtAddress.Text = " " Then
rs1.AddNew
rs1.Fields("Comment") = "Insufficient Author Data"
rs1.Update
Else
rs1.AddNew.......
The problem is that if either of the author, name, or address text boxes are empty on my form, the code just jumps down to the Else instead of rs1.AddNew (after Then)
What am I doing wrong please???
Else
-
Apr 8th, 2002, 11:22 PM
#2
i am thinking maybe because you have
Code:
If txtAuthor.Text = " " Or txtName.Text = " " Or txtAddress.Text = " " Then
maybe try to put in
Code:
If txtAuthor.Text = "" Or txtName.Text = "" Or txtAddress.Text = "" Then
it looks like you are checking for a space where you really are looking for empty strings.
-
Apr 8th, 2002, 11:25 PM
#3
Addicted Member
If txtAuthor.Text = " " Or txtName.Text = " " Or txtAddress.Text = " " Then
should be
If txtAuthor.Text = "" Or txtName.Text = "" Or txtAddress.Text = "" Then
( no spaces between "" )
-
Apr 8th, 2002, 11:25 PM
#4
Thread Starter
New Member
Your a living legend!
Appreciate that.
-
Apr 8th, 2002, 11:25 PM
#5
You could try dropping the ELSE too.
ie.
VB Code:
Private Sub cmdAdd_Click()
If rs2.NoMatch Then
If txtAuthor.Text = "" Or txtName.Text = "" Or txtAddress.Text = "" Then
rs1.AddNew
rs1.Fields("Comment") = "Insufficient Author Data"
rs1.Update
[b]Exit Sub[/b]
End If
End If
'
rs1.AddNew 'Whatever else here
'
End Sub
Last edited by Bruce Fox; Apr 8th, 2002 at 11:29 PM.
-
Apr 8th, 2002, 11:25 PM
#6
Also try putting in a breakpoint there and checking the values when it breaks. It's probably because of the spaces.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|