By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,649 Members | 696 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,649 IT Pros & Developers. It's quick & easy.

Problem with checking if a value entered is equal to one in a DB

P: 84
Ok this is my first post, gtz me ^^

well i have a DB im making for a project and im using a Vb interface and a access db linking them togethering using ADO.

on one SStab / form i have a drop down box that is populated from a form "orders" in the DB, that works fine.

but when i try and use an IF statement to see if the value entered in a text box is equal to the value in the database it comes up with the same result if its right or wrong, if you get what i meen :D heres some code

Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\cjmillers.mdb"
Data1.RecordSource = "select * from Orders"

-------------------------


Private Sub Command24_Click()
'vehical validate
With Data1
.Recordset.MoveFirst
Do Until .Recordset.EOF
If Not (.Recordset.Fields(3) = Text13.Text) Then
Label47.Visible = True
Exit Sub
Else
.Recordset.MoveNext
End If
Loop
End With
End Sub

-----------------

Thanks, hope you can help

P.s im sorry if this is in the wrong place :(
Sep 20 '07 #1
Share this Question
Share on Google+
2 Replies


VBPhilly
P: 95
Ok this is my first post, gtz me ^^

well i have a DB im making for a project and im using a Vb interface and a access db linking them togethering using ADO.

on one SStab / form i have a drop down box that is populated from a form "orders" in the DB, that works fine.

but when i try and use an IF statement to see if the value entered in a text box is equal to the value in the database it comes up with the same result if its right or wrong, if you get what i meen :D heres some code

Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\cjmillers.mdb"
Data1.RecordSource = "select * from Orders"

-------------------------


Private Sub Command24_Click()
'vehical validate
With Data1
.Recordset.MoveFirst
Do Until .Recordset.EOF
If Not (.Recordset.Fields(3) = Text13.Text) Then
Label47.Visible = True
Exit Sub
Else
.Recordset.MoveNext
End If
Loop
End With
End Sub

-----------------

Thanks, hope you can help

P.s im sorry if this is in the wrong place :(
your label is not being set to Label47.Visible = False anywhere. But it does set to .Visible = True. Once true, it will never go invisible based on your IF/END IF handling.

Is this what you are referring to when saying it comes up with same result?
Sep 20 '07 #2

P: 84
your label is not being set to Label47.Visible = False anywhere. But it does set to .Visible = True. Once true, it will never go invisible based on your IF/END IF handling.

Is this what you are referring to when saying it comes up with same result?

Sorry for th l8 reply ive been concentrating on other parts of my project =)
the label47.visible is set to false when the form loads ( in its properties menu on the right)

i see what u meen about it never going false again i try and sort that out, thx for your help :D
Sep 26 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.