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

Data control error

Status
Not open for further replies.

mike314

Programmer
Jun 24, 2003
143
0
0
US
i have this app that opens Excel
spreadsheets in an MSFlexGrid (a control similar to
a DataGrid). The only problem I am having is that
i want the default Excel worksheet to open. With my
code I have to tell it to open the worksheet. Any ideas?
I am using an MSFlexGrid, Data control and CommmonDialog control.
i already changed the Data1.connect property
Any Help is much appreciated!!
Heres the code:


CommonDialog1.Filter = "All files|*"
CommonDialog1.ShowOpen
If CommonDialog.FileName <> &quot;&quot; Then
Data1.DatabaseName = CommonDialog1.FileName
Data1.RecordSource = &quot;Sheet1&quot; ' NOTE: This is the problem line
Data1.Refresh
End If


The Data1.RecordSource line should open the default, leaving it
out opens nothing. This is possible because I read it in a book a long time ago.
 
I have not done much in this area but should you not use something like Book1:Sheet1 ?? Just a thought. I hope it helps.

Noble
 
Try appending a &quot;$&quot; to the Worksheet name in the RecordSource property e.g. &quot;Sheet1$&quot; as the table name and &quot;Excel 8.0;&quot; for the Connect property.


Andy
&quot;Logic is invincible because in order to combat logic it is necessary to use logic.&quot; -- Pierre Boutroux
&quot;Why does my program keep showing error messages every time something goes wrong?&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top