473,395 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

is there any vb line i can use

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
2 1624
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
Killer42
8,435 Expert 8TB
I wonder whether these machines might have out of date versions of some runtime modules, or Activex controls.
Apr 21 '07 #3

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

Similar topics

8
by: Peter A. Schott | last post by:
Per subject - I realize I can copy/paste a line at a time into an interactive session when I'm trying to debug, but was wondering if there is any tool out there that allows me to copy sections of...
65
by: Skybuck Flying | last post by:
Hi, I needed a method to determine if a point was on a line segment in 2D. So I googled for some help and so far I have evaluated two methods. The first method was only a formula, the second...
22
by: DraguVaso | last post by:
Hi, For my application I need the following behavior: When I press F4 the cursor has to move to the next line in my multiline textbox which begins with "0". Finding lines starting with 0 isn't...
3
by: Double Echo | last post by:
Hi all, I'm using PHP 4.4.2, and use PHP on both the command-line and the web. I am running PHP on SuSE 10 Linux , in a VMware 5.5 workstation, using Apache 2.0.55 , on my Dell laptop. ...
9
by: Adi | last post by:
Hello eveyone, I wanna ask a very simple question here (as it was quite disturbing me for a long time.) My problem is to read a file line by line. I've tried following implementations but still...
6
by: magix | last post by:
Hi, when I read entries in file i.e text file, how can I determine the first line and the last line ? I know the first line of entry can be filtered using counter, but how about the last line...
6
by: Jacob Rael | last post by:
Hello, I have a simple script to parse a text file (a visual basic program) and convert key parts to tcl. Since I am only working on specific sections and I need it quick, I decided not to...
14
by: WStoreyII | last post by:
the following code is supposed to read a whole line upto a new line char from a file. however it does not work. it is producing weird results. please help. I had error checking in there for...
11
by: xdevel | last post by:
Hi, I don't understand option. if I write: #line 100 "file" I change file numeration to start to line 100 but what "file" ? any example?
19
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
This is an example of the data; 2007/07/27 11:00:03 ARES_INDICATION 010.050.016.002 404.2.01 (6511) RX 74 bytes 2007/07/27 11:00:03 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.