Ok i have a working login screen on my project but its running the old DAO / data object style, but the rest of my project is is ADO / SQl ( i think :0 )
This is what i have for the new ADO
[CODE=vb]Public UserRS As New ADODB.Recordset
Public UserCONN As New ADODB.Connectio n
Public UserSQL As String ' global sql string
Public HoldUser As String[/CODE]
[CODE=vb] Function ConnectUser()
Dim UserSQL As String
Set UserCONN = New ADODB.Connectio n
If UserCONN.State = 1 Then
UserCONN.Close
End If
MSDatabaselogin = App.Path & ("\login.mdb ")
UserSQL = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & MSDatabaselogin & ";Persist Security Info=False"
UserCONN.Open (UserSQL), , , 0
End Function
Function OpenUserDB(User SQL As String)
ConnectUser
Set UserRS = Nothing
If UserRS.State = 1 Then
UserRS.Close
End If
UserRS.CursorLo cation = adUseClient
UserRS.Open UserSQL, UserCONN, adOpenDynamic, adLockOptimisti c
End Function
[/CODE]
And this is on the login command button
[CODE=vb]
UserSQL = "SELECT * FROM User"
OpenUserDB (UserSQL)
If (UserRS("Userid ") = Text1.Text) And (UserRS("passwo rd") = Text2.Text) Then
Form1.Hide
Main_menu.Show
Main_menu.Capti on = "Welcome user..."
Timer1.Enabled = True
'Permissions
Main_menu.mnu_A dmin.Enabled = False
'-----------
Exit Sub
End If
Exit Sub
[/CODE]
It comes up with an errors saying "Syntax in Error FROM clause"
then highlights
[CODE=vb]UserRS.Open UserSQL, UserCONN, adOpenDynamic, adLockOptimisti c[/CODE]
Can anyone give any suggestions why this is happening ?
This is what i have for the new ADO
[CODE=vb]Public UserRS As New ADODB.Recordset
Public UserCONN As New ADODB.Connectio n
Public UserSQL As String ' global sql string
Public HoldUser As String[/CODE]
[CODE=vb] Function ConnectUser()
Dim UserSQL As String
Set UserCONN = New ADODB.Connectio n
If UserCONN.State = 1 Then
UserCONN.Close
End If
MSDatabaselogin = App.Path & ("\login.mdb ")
UserSQL = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & MSDatabaselogin & ";Persist Security Info=False"
UserCONN.Open (UserSQL), , , 0
End Function
Function OpenUserDB(User SQL As String)
ConnectUser
Set UserRS = Nothing
If UserRS.State = 1 Then
UserRS.Close
End If
UserRS.CursorLo cation = adUseClient
UserRS.Open UserSQL, UserCONN, adOpenDynamic, adLockOptimisti c
End Function
[/CODE]
And this is on the login command button
[CODE=vb]
UserSQL = "SELECT * FROM User"
OpenUserDB (UserSQL)
If (UserRS("Userid ") = Text1.Text) And (UserRS("passwo rd") = Text2.Text) Then
Form1.Hide
Main_menu.Show
Main_menu.Capti on = "Welcome user..."
Timer1.Enabled = True
'Permissions
Main_menu.mnu_A dmin.Enabled = False
'-----------
Exit Sub
End If
Exit Sub
[/CODE]
It comes up with an errors saying "Syntax in Error FROM clause"
then highlights
[CODE=vb]UserRS.Open UserSQL, UserCONN, adOpenDynamic, adLockOptimisti c[/CODE]
Can anyone give any suggestions why this is happening ?
Comment