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

Data environment Designer Type Mismatch

Status
Not open for further replies.

dpatrickcollins

Programmer
Nov 18, 2002
79
Just learning how to use the Data Environment designer and I am going by the book. After creating a connection to an Access database and a command to retrieve data from a single table, the following code is failing in the Form_Load Event:

Private Sub Form_Load()
Dim rs As ADODB.Recordset
Set rs = DataEnvironment1.Command1
End Sub

I am getting the error stating "Type Mismatch" and Command1 is highlighted. What am I doing wrong?
 
What you trying to make/do ? Work with Data Report or you are trying to connect to database for add/edit/save/query ?

if you are trying to connect to database for add/edit/save/query then use
Adodc, Adodb

if you are trying to make data report (for printing) then use dataEnvironment.

to use dataEnvironment , get connected to database, then you will see all tables are loaded.
make your datareport and drag dataEnvironment tables to that report , i would suggest you decide what you are trying to do ? thats why i am stoping here.
 
If Command1 is recordset returning then it will be prefixed with 'rs', plus you need to open it first, so..


dim rs as New Recordset

DataEnvironment1.Command1
With DataEnvironment1.rsCommand1
If Not (.EOF AND .BOF) Then
Set rs = .Clone
End If
.Close
End With
 
Thanks, pokermat. The missing piece was issuing the command first, then connecting to the "rs" recordset object. I was trying inadvertently to assign a recordset variable to a command.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top