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

run time error -2147467259(80004005)-

P: 1
I am trying to run the following code :-----
Expand|Select|Wrap|Line Numbers
  1. Public Function Fill() As Variant
  2. Dim reccheck As ADODB.Recordset
  3. Dim fldcheck As ADODB.Field
  4. Set reccheck = New ADODB.Recordset
  5. Set reccheck.ActiveConnection = CurrentProject.Connection
  6. Dim str As String
  7. str = Format(curdate.Value, "dd/mmm/yy")
  8. reccheck.Source = "work_details"
  9. reccheck.Open "select tslot2 from work_details where emp_id=" & Text13.Value & " and current_date = " & str & "; "
  10. reccheck.MoveFirst
I am getting the following erroe:----run time error -2147467259(80004005)-Method 'Open' of object _recordset failed

Can any body help me????
Jan 1 '08 #1
Share this Question
Share on Google+
1 Reply


puppydogbuddy
Expert 100+
P: 1,923
I am trying to run the following code :-----

Public Function Fill() As Variant
Dim reccheck As ADODB.Recordset
Dim fldcheck As ADODB.Field
Set reccheck = New ADODB.Recordset
Set reccheck.ActiveConnection = CurrentProject.Connection
Dim str As String
str = Format(curdate.Value, "dd/mmm/yy")
reccheck.Source = "work_details"
reccheck.Open "select tslot2 from work_details where emp_id=" & Text13.Value & " and current_date = " & str & "; "
reccheck.MoveFirst

I am getting the following erroe:----run time error -2147467259(80004005)-Method 'Open' of object _recordset failed

Can any body help me????

See if this syntax works. This syntax is based on the ADO example at this link: http://allenbrowne.com/func-ADO.html


Expand|Select|Wrap|Line Numbers
  1. Public Function Fill() As Variant
  2.  
  3. 'Declarations
  4. Dim reccheck As ADODB.Recordset
  5. Dim fldcheck As ADODB.Field
  6.  
  7. 'Obtain a criterion for WHERE clause, and
  8. 'construct Select statement
  9.  
  10. Dim str As String
  11. str = Format(curdate.Value, "dd/mmm/yy")
  12. str = "select tslot2 from work_details where emp_id=" & Text13.Value & " and current_date = " & str & "; "
  13.  
  14. 'open the recordset
  15. Set reccheck = New ADODB.Recordset
  16. reccheck.Open str, CurrentProject.Connection
  17.  
  18. 'Loop through recordset until EOF
  19. Do While Not reccheck.EOF
  20.     Debug.Print reccheck!tslot2 & ";" & reccheck!emp_id & ";" & reccheck(str) 
  21.     reccheck.MoveNext
  22. Loop
  23.  
  24. 'Clean up objects and links
  25. reccheck.Close
  26. Set reccheck = Nothing
Jan 1 '08 #2

Post your reply

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