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

is there any vb line i can use

P: 10
i am developing a human resources profiler system. the problem is that the system cannot log on on some machines giving me a 'runtime error 2147220999(800401f9) method of object_current project failed' pointing on the following line
rs.Open str_sel, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
my code is as follows

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3. Private Sub ACCEPT_Click()
  4. Dim ls_username, ls_username_1, ls_password, ls_password_1  As String
  5. Dim str_sel As String
  6. Dim rs As Recordset
  7. Dim rs_count As Integer
  8. ls_username = Me.User_name.Value
  9. ls_password = Me.password.Value
  10.  
  11. 'Set dbs = CurrentDb
  12. str_sel = "SELECT * FROM USERS WHERE [USERNAME] = '" & ls_username & "';"
  13. If IsNull(ls_username) Then
  14. MsgBox "Please enter username", vbInformation, "Payroll Logon"
  15. Else
  16. Set rs = New ADODB.Recordset
  17. rs.Open str_sel, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
  18.  
  19. 'Set rs = openrecordset(str_sel)
  20. rs_count = rs.RecordCount
  21. If rs_count < 1 Then
  22. MsgBox "Username Does not exist", vbCritical, "Payroll Logon"
  23. Else
  24. ls_password_1 = rs!password
  25. If ls_password_1 <> ls_password Or IsNull(ls_password) Then
  26. MsgBox "Please Enter Correct Password ", vbCritical, "Payroll Logon"
  27. Else
  28. gsusername = rs!Username
  29. gsprofile = rs!Profile
  30. gl_Full_name = rs!Full_name
  31. 'MsgBox " Username and password super", vbInformation, "btags"
  32. DoCmd.Close
  33. 'DoCmd.OpenForm "rate", acNormal
  34. End If
  35. End If
  36. DoCmd.OpenForm "main", acNormal
  37. End If
  38. End Sub
please help me out i am stranded
Apr 19 '07 #1
Share this Question
Share on Google+
2 Replies


P: 47
iam developing a human resources profiler system. the problem is that the system cannot log on on some machines giving me a 'runtime error2147220999(800401f9) method of object_current project failed' pointing on the following line
rs.Open str_sel, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
my code is as follows

Option Compare Database

Private Sub ACCEPT_Click()
Dim ls_username, ls_username_1, ls_password, ls_password_1 As String
Dim str_sel As String
Dim rs As Recordset
Dim rs_count As Integer
ls_username = Me.User_name.Value
ls_password = Me.password.Value

'Set dbs = CurrentDb
str_sel = "SELECT * FROM USERS WHERE [USERNAME] = '" & ls_username & "';"
If IsNull(ls_username) Then
MsgBox "Please enter username", vbInformation, "Payroll Logon"
Else
Set rs = New ADODB.Recordset
rs.Open str_sel, CurrentProject.Connection, adOpenKeyset, adLockOptimistic

'Set rs = openrecordset(str_sel)
rs_count = rs.RecordCount
If rs_count < 1 Then
MsgBox "Username Does not exist", vbCritical, "Payroll Logon"
Else
ls_password_1 = rs!password
If ls_password_1 <> ls_password Or IsNull(ls_password) Then
MsgBox "Please Enter Correct Password ", vbCritical, "Payroll Logon"
Else
gsusername = rs!Username
gsprofile = rs!Profile
gl_Full_name = rs!Full_name
'MsgBox " Username and password super", vbInformation, "btags"
DoCmd.Close
'DoCmd.OpenForm "rate", acNormal
End If
End If
DoCmd.OpenForm "main", acNormal
End If
End Sub

please help me out iam sranded
Hi ,
I have Some Question regarding your code.

What type of control this are???
Expand|Select|Wrap|Line Numbers
  1. ls_username = Me.User_name.Value
  2. ls_password = Me.password.Value
  3.  
if its textbox controls(I think So) then you should use
Expand|Select|Wrap|Line Numbers
  1. ls_username = Me.User_name.text
  2. ls_password = Me.password.text
  3.  
2nd ly
???????
Expand|Select|Wrap|Line Numbers
  1. rs.Open str_sel, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
  2.  
is currentproject is connection object(again i think so) then use only object name.provided that
1) you have a valid connection String
2)connection Object should be open before u open the recordset object
Expand|Select|Wrap|Line Numbers
  1. rs.Open str_sel, CurrentProject, adOpenKeyset, adLockOptimistic
  2.  
if CurrentProject is your Project name & Connection is the Connection Object
then the above mention code is OK .
Ok?
Apr 20 '07 #2

Expert 5K+
P: 8,434
I wonder whether these machines might have out of date versions of some runtime modules, or Activex controls.
Apr 21 '07 #3

Post your reply

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