DataReport with Code

mandk10
01-27-2004, 01:40 PM
OK call me stupid. Well no don't. But anyway. I have been trying to design a report using VB's Datareport tool. I have connected it to my data source using the following code or other such simular ways of doing it.

Dim objrs As New Recordset
mySQL = "SELECT Description, Manufacturer, Category, Location FROM Items"
g_Conn.CursorLocation = adUseClient

objrs.Source = mySQL
Set objrs.ActiveConnection = g_Conn
objrs.Open

datareport1.datasource = objrs



but when I try to access any text boxes I put on the form they are not recognized. In this case Text1 is not recognized.



DataReport1.Sections.Item("section1").Controls.Item("Text1").datasource = "Whatever"



I have looked at various posts on this very subject and have tried various things and cannot get this to work.

Yes I have service pack 5 and yes I have mdac 2.8

I thank anyone in advance that can walk me through this. I can provide more details as needed

Shurik12
01-27-2004, 01:51 PM
Hi,

Should not it be?:


...Controls.Item("Text1").DataField=objrs.Fields("NameOfTheField").Value


Regards,
Shurik.

mandk10
01-27-2004, 04:48 PM
Hi,

Should not it be?:


...Controls.Item("Text1").DataField=objrs.Fields("NameOfTheField").Value


Regards,
Shurik.

As a matter of fact, it should be. Thank you so much. I have been pondering this for some time now. I have an application that is nearly ready for beta and the main hangup has been the reports.

Now I just have to figure out how to break down sections according to a field. Sort of like "SELECT DISTINCT..." to get the headers and then the items that follow that criteria listed below the header. But I will save that question for another day, if I cannot figure it out on my own

Again thank you very much.

Michael

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum