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

Problem linking VB6 DataReports to Access database...

Status
Not open for further replies.

GWhiz

Programmer
Dec 16, 1999
49
US
Am building VB6 application which accesses table/data created in Access.<br>
<br>
In VB6, have added Connection1 to DataEnvironment1 which has Data Link to the desired Access database. &quot;Test Connection&quot; button comes back &quot;successful&quot;.<br>
<br>
Then, in building DataReport1, &quot;DataEnvironment1&quot; appears (as expected) as one of the choices (in this case, the only choice) in the DataSource property of DataReport1. Apparently, there is no automatic display of choices for &quot;DataMember&quot; property of DataReport once DataSource has been defined (I would expect to see a list of queries/tables once DataSource has been defined), so I typed in valid query name that is part of Access database.<br>
<br>
Have added text boxes to DataReport1 to display fields from Access database. Text box &quot;DataMember&quot; property automatically shows DataMember as typed in DataMember property of DataReport1 (above) as one of the choices (in this case, the only choice).<br>
<br>
Having done all this, I would expect &quot;DataField&quot; property of Text Box on DataReport1 to display a list of fields from DataMember selection. No list of fields is displayed.<br>
<br>
Continued anyway to type in valid field name in &quot;DataField&quot; property of text box.<br>
<br>
In test run &quot;print preview&quot; of DataReport1, I get the error message &quot;Failed getting rows from current data source.&quot;<br>
<br>
I'm befuddled/bewildered/flummoxed/bamboozled. Don't know how to properly link VB6 DataReport to Access database. Does this need to be done in code, or does DataEnvironment/Connection take care of defining and linking the source database to the DataReport text boxes?<br>
<br>
Seems like MS tried to make this as simple and intuitive as possible, but I can't seem to make this work.<br>
<br>
Any suggestions?<br>

 
When in doubt, read the instructions (although the path IS a little convoluted, perhaps unnecessarily so).<br>
<br>
You have to dig into &quot;Connection1&quot; a bit more:<br>
<br>
* right-click &quot;Connection1&quot;, then select &quot;Add Command&quot;<br>
<br>
* right-click on &quot;Command1&quot; (created by &quot;Add Command&quot;); select &quot;Properties&quot;<br>
<br>
* pick some usable name for Command1 to be used as a reference in &quot;DataMember&quot; property of report and text boxes<br>
<br>
* select Source of Data (could be a table, a &quot;View&quot; or query, etc.), then the &quot;Object Name&quot;, which is a list of choices generated after &quot;Source of Data&quot; has been chosen<br>
<br>
* get into Report Design view, select properties for DataReport<br>
<br>
* set &quot;DataSource&quot; for report to reference name chosen for DataEnvironment1; set &quot;DataMember&quot; property of report to reference name chosen for Command1 (will appear as list of choices once DataSource has been defined)<br>
<br>
* at this point, you can add text boxes to report. Set &quot;DataMember&quot; property of text box to reference name chosen for Command1 (above, same as DataMember of report), then list of fields will appear in &quot;DataField&quot; property of Text Box<br>
<br>
Intuitive? Well, I'm not so sure about that. But it makes a lot more sense after you do it the first time...
 
&lt;smile&gt; That's the kind of question we like to see - one where the poster answers it him/herself!!<br>
<br>
Mike <p>Mike Lacey<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top