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

VB6 Data Forms-DAO Recordsource-'Invalid Datasource'

Status
Not open for further replies.

hafod

Technical User
Mar 14, 2005
73
0
0
GB
Hi
I have completed an application using VB6 and DAO rather than ADO recordsets. There are various requirements to display the retrieved data on a Form (as in the Access Report Generator) for subsequent viewing and printing.

I am having problems getting the report - named 'drSubscriptionsLog' to bind to the recordset (which is populated and on the same form) to a DAO recordset - datSubscriptionsLog. MS Help suggests this can be done at Design Time. I have set the Recordset of the report to 'datSubscriptionsLog' - the recordset.

When I try to run the report using subscriptionslog.Visible = True (on a command button click-event) at the moment, I get the message 'Invalid Data Source'. Yet, the DAO record souce is perfectly valid and is open - for business!!

Any suggestions would be welcome. I havent used the Data Form object before and reference material seems very limited.

Many thanks in anticipation

 
The Data Report can only handle a recordset from the Data Environment, or straight from a ADODB recordset. As far as I am aware of, a DAO DataControl or recordset will not work with the Data Report.

You may want to have a look at the Crystal Reports object shipped with VB6, and use this for reporting.

Be advised: DAO has long retired, and the Crystal Reports 6 object shipped with VB6 is also 10 years old.
It would be better to invest the time to change to ADO.
Also, (though I cannot confirm this, but have only heard of it), you may have problem with the Crystal Reports 6/7 OCX under Vista.
 
Hi
Many thanks for your post. I am using VB6 under Windows XP (and will be for some time - Wait for a 'mature' Vista release!). I take your point on ADO as a means of using Data Forms and will need to invest more time in this direction. I know Crystal Reports was shipped as a third party program with VB5 but wasnt aware it was with VB5 - will check my CD.

Many thanks for your post - and helpful advice
Mike
 
Hi There, it is nice to see that so many people have problems with data reports and data environment. I also have one and have just joined this site for some assistance if possible. Basically all I am trying to do is create a simple report and display data from an SQL statement. I have tried all day to get it to work and it keeps erroring. HELP someone please....
I am using an Access 2000 db, VB6 SP5. My code is below: -
Dim cn_ForReport As ADODB.Connection
Dim rs_ForReport As ADODB.Recordset
Dim strSQL As String
path = App.path & "\RENTS.MDB"
Set cn_ForReport = New ADODB.Connection

cn_ForReport.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & path

cn_ForReport.Open

strSQL = "SELECT EntryDate, FCR, CS, EXEC6, EXEC6PLUS, " & _
"EXEC12, EXEC12PLUS, TotalExVAT, VAT, TotalAmount " & _
"from tblTenant"

Set rs_ForReport = cn_ForReport.Execute(strSQL)

' Connect the Recordset to the DataReport.
Set drReports.DataSource = rs_ForReport
drReports.Show (vbModal)

The report has exactly the same fields except I have named the txt boxes like txtFCR and txtCS etc.
The message I get back is this one : -
Arguments are the wrong type, are out of acceptable range, or are in conflict with one another.

I am really getting knarked now so can anyone help please?????

Thanks in advance.

Graham
 
What is the error number and on which line does the error happen (Set drReports.DataSource = rs_ForReport)?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top