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

trouble creating recordsets

Status
Not open for further replies.

autoIT

IS-IT--Management
May 10, 2006
68
US
I think i need to activate a rference library, but maybe it's more than than:

dim rs as adodb.recorset

rs.open "Employees", cn, adOpendynamic, adLockOptimistic, adCmdTable

**at this point when i start typing ad..itellisense doesn't give me options for any of these, anyone know why?


also i call another private sub that should populate text boxes:

txtEmpName.setfocus
txtEmpName.text=rs.Fields.Item("Employee Name")

**Now at this point itellisense is doing its thing until =rs.Fields in which point it won't show anything.


Is there a reference library that needs to be activated or is should is this all part of the active x controls and I just need to activate a more current version than 2.1. I am currentyl beta testing office 07 as well.


thanks
Adam
 
<Is there a reference library that needs to be activated

Yes, there is. Set a reference to the Microsoft ActiveX Data Objects Version 2.x library, where x should be the latest number that you find in the list, like 2.8.

I would NOT recommend that you use a dynamic recordset, by the way. It is the most restrictive recordset in terms of locks placed and overhead. For further information, see faq222-3670. Try to use the recordset that represents the least overhead and still accomplishes what you need to accomplish.

HTH

Bob
 
Bob,
thanks for the help. If i'm using access '07 will active x 2.8 be the best t use, or is there a treference library not yet created for it.

Adam
 
I'm not sure about access 07, but I'd try using 2.8 and see where I get. Gotta love Microsoft's commitment to backward compatibility....
 
I resolved that whole issue but since you're incredibly resourceful I figured you wouldn't mind answering an easier one.

run-time error '13': Type mismatch


I researched the hell out of this and I see different solutions none of which help me. I know this is a common question, but code all looks right and i used an online tutorial to lay the outline. I'll include my code for form load and the general declarations becasue that seems to be where the errot occurs:


Option Compare Database
Option Explicit
Dim cn As Connection
Dim rs As New ADODB.Recordset
Dim DelConfirm As Integer
Dim ctl As Control



'sets varibales for connection and recordset, opens connection to table, call fillcontrols procedure that will fill info into textboxes

Private Sub Form_Load()
For Each ctl In Controls
If TypeOf ctl Is TextBox Then
ctl.BackColor = vbWhite
End If
Next



cmdInsert.Visible = False
cmdNext.Visible = True
cmdPrev.Visible = True
cmdNew.Visible = True

Set cn = CurrentProject.Connection
Set rs = New ADODB.Recordset

rs.Open "tblEmpInfo", cn, adOpenDynamic, adLockOptimistic, adCmdTable

FillControls
End Sub
 
Ok, this is really a VBA question, so you probably should be in the Access VBA forum. I would repost this thread to there, and also I would publish the exact line where you're having the error. My guess is that the problem is in your fillcontrols routine, though.

HTH

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top