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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Compare

Status
Not open for further replies.
Jul 19, 2003
19
IN
i'm new to VB

Code:
for RS!Name = txtName Then
    Count = Count+1
End If

is there any errors
or
how to compare Strings
please help me

__King__
 
sorry mistake in early post
please check this

i'm new to VB


Code:
If RS!Name = txtName Then
    Count = Count+1
End If

is there any errors
or
how to compare Strings
please help me
__King__


__King__
 
What you have written is syntactically correct, however depending on about a gazillion other factors it may not work. You need to post more of the surrounding code.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Code:
Private Sub cmdBaseOk_Click()
    Dim DB As Database
    Dim RS As Recordset
    Dim confir As Integer
    
    confir = 0
    
    Set DB = OpenDatabase("c:\pass.mdb")
    Set RS = DB.OpenRecordset("pass", dbOpenDynaset)
    
    If RS.EOF Then RS.MoveFirst
    
    Do While Not RS.EOF
        If RS!Name = txtBaseName Then
           If RS!pass = txtBasePass Then confir = 1
        End If
        RS.MoveNext
    Loop
    If confir = 1 Then
        MsgBox "Ok" & confir
    Else
        MsgBox txtBasePass & confir
    End If
    DB.Close
End Sub

__King__
 
Why are you using an exclamation mark in a recordset property variable? I haven't worked with this stuff, so am not familiar with the naming conventions.

Lee
 
Stil more needed / necessary.

txtBaseName is either not declared at all (no Option Explicit) and therefore is just 'empty', or declared elsewhere and therefore of (for this purpose) of unknown type.

Altogether, it looks like an rank beginners attempt to reference a control on a form, but the details still need to be expressed, variables declared and thought given to the language structure and syntax.





MichaelRed


 
Is the name of the table pass and the name of the database also pass?

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top