Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How to handle Blanks (empty Rows)

Good day all,

I have developed an Upload from excel to and ERP system. The way it
works is it will use OLEDB to run a select statement for fields that I
need, then i insert the results into a DataSet and form the dataset
its uploaded to the ERP system after a number of integ checks. This is
done for 100 diffrent xls file at a time.

There is how ever quite a big problem (isnt there always :P) when I
reach a file that starts with lest say more than TWO blank rows
(excluding HDR), the select statment exsits and no other data is
returned, for example:

Data EXAMPLE:

F1 F2 F3 F4
BLANK BLANK BLANK BLANK
BLANK BLANK BLANK BLANK
BLANK BLANK BLANK BLANK
BLANK BLANK BLANK BLANK
DATA DATA DATA DATA
DATA DATA DATA DATA
DATA DATA DATA DATA
DATA DATA DATA DATA
DATA DATA DATA DATA
DATA DATA DATA DATA
DATA DATA DATA DATA
DATA DATA DATA DATA
DATA DATA DATA DATA
DATA DATA DATA DATA

And I run Select F1,F2 ,F3,F4 from [Upload ERP$] the returned dataset
is 0 records ..... EVEN though after the four blank rows there is data
that should be retrived!!

But if the data is formatted as

F1 F2 F3 F4
DATA DATA DATA DATA
BLANK BLANK BLANK BLANK
DATA DATA DATA DATA
BLANK BLANK BLANK BLANK
DATA DATA DATA DATA
DATA DATA DATA DATA
DATA DATA DATA DATA
DATA DATA DATA DATA
BLANK BLANK BLANK BLANK
DATA DATA DATA DATA
BLANK BLANK BLANK BLANK
DATA DATA DATA DATA
BLANK BLANK BLANK BLANK
DATA DATA DATA DATA

Then the same select statement will work and just ignore the blank
rows, is there something I am missing here?

Thank you for your time.

Carlos Magalhaes
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How to handle Blanks (empty Rows)

Carlos,
How about setting a range in the work book for your query. You can open
the workbook and see where the data starts and ends. Then set a range in
the workbook and save it. Then you can select from the range in the
workbook, when retrieving your rows. Or if you don't want to save a named
range you can adjust your query to select only the cells you know have
data. Here's a pseudo sample…

Specify a Named Range

To specify a named range of cells as your recordsource,
simply use the defined name. For example:

strQuery = "SELECT * FROM MyRange"


Specify an Unnamed Range

To specify an unnamed range of cells as your recordsource, append standard
Excel row/column notation to the end of the sheet name in the square
brackets. For example:


strQuery = "SELECT * FROM [Sheet1$A1:B10]"


Here's a good KB Article that covers this information, and a lot more.
257819 HOWTO: Use ADO with Excel Data from Visual Basic or VBA
http://support.microsoft.com/?id=257819


Hope this helps out!

Stephen Culhane

Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.




--------------------
| From: Carlos Magalhaes
| Subject: How to handle Blanks (empty Rows)
| Date: Fri, 05 Dec 2003 10:14:25 +0200
| Organization:
http://groups.yahoo.com/group/ADSIANDDirectoryServices
| Reply-To:
| Message-ID:
| X-Newsreader: Forte Agent 1.93/32.576 English (American)
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Newsgroups: microsoft.public.excel.programming
| NNTP-Posting-Host: mail.trencor.co.za 195.75.154.163
| Lines: 1
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!TK2MSFTNGP09.
phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.excel.programming:439758
| X-Tomcat-NG: microsoft.public.excel.programming
|
| Good day all,
|
| I have developed an Upload from excel to and ERP system. The way it
| works is it will use OLEDB to run a select statement for fields that I
| need, then i insert the results into a DataSet and form the dataset
| its uploaded to the ERP system after a number of integ checks. This is
| done for 100 diffrent xls file at a time.
|
| There is how ever quite a big problem (isnt there always :P) when I
| reach a file that starts with lest say more than TWO blank rows
| (excluding HDR), the select statment exsits and no other data is
| returned, for example:
|
| Data EXAMPLE:
|
| F1 F2 F3 F4
| BLANK BLANK BLANK BLANK
| BLANK BLANK BLANK BLANK
| BLANK BLANK BLANK BLANK
| BLANK BLANK BLANK BLANK
| DATA DATA DATA DATA
| DATA DATA DATA DATA
| DATA DATA DATA DATA
| DATA DATA DATA DATA
| DATA DATA DATA DATA
| DATA DATA DATA DATA
| DATA DATA DATA DATA
| DATA DATA DATA DATA
| DATA DATA DATA DATA
| DATA DATA DATA DATA
|
| And I run Select F1,F2 ,F3,F4 from [Upload ERP$] the returned dataset
| is 0 records ..... EVEN though after the four blank rows there is data
| that should be retrived!!
|
| But if the data is formatted as
|
| F1 F2 F3 F4
| DATA DATA DATA DATA
| BLANK BLANK BLANK BLANK
| DATA DATA DATA DATA
| BLANK BLANK BLANK BLANK
| DATA DATA DATA DATA
| DATA DATA DATA DATA
| DATA DATA DATA DATA
| DATA DATA DATA DATA
| BLANK BLANK BLANK BLANK
| DATA DATA DATA DATA
| BLANK BLANK BLANK BLANK
| DATA DATA DATA DATA
| BLANK BLANK BLANK BLANK
| DATA DATA DATA DATA
|
| Then the same select statement will work and just ignore the blank
| rows, is there something I am missing here?
|
| Thank you for your time.
|
| Carlos Magalhaes
|

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I make a Chart data series treat blanks as "Empty" cells XLADLK Charts and Charting in Excel 12 June 9th 08 10:53 PM
using fill handle with hidden rows Shazzer Excel Discussion (Misc queries) 2 July 20th 07 02:56 PM
handle data with too many rows hurriance New Users to Excel 2 January 27th 06 04:02 PM
Excel should handle more than 65,536 rows. colekp Excel Discussion (Misc queries) 2 September 26th 05 04:01 PM
To many rows for EXCEL to handle moglione1 Excel Discussion (Misc queries) 3 September 9th 05 02:52 PM


All times are GMT +1. The time now is 11:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"