0

My -layout is not as expected: Why does .getstring create a single cell at the end of the table? Is this a bug? Can you fix this via getrow and join?

Thanks for your tips

Getstring-Example@ http://www.w3schools.com

kwnwzlnd
  • 48
  • 5

1 Answers1

1

It's a known... well, annoyance. (Otherwise known as a bug that will never get fixed.) You either have to trim off the extra delimiters using Left(), or you have to use something other than .GetString. .GetRows is probably the most useful, but note that you can't use Join with it: the latter requires a one-dimensional array, while GetRows always returns a two-dimensional array, even if the recordset only returned one column and/or row.

Martha
  • 3,932
  • 3
  • 33
  • 42
  • Thank you Martha.It's funny that you can't find any hints about that behaviour. Even Db-Tutorials don't fix that problem. E.g. W3school only emphazise the speed of the getstring-Method – kwnwzlnd Oct 24 '16 at 04:22
  • What do you think about this modification. Is this practicable: – kwnwzlnd Oct 24 '16 at 08:10
  • pseudo-code: rs.Open "SELECT '' + Companyname + '' + Contactname + "' FROM Customers", conn str=rs.GetString(,,,chr$(13),"") - - for just getting the HTML-result. The empty row should be only appear in html not in a real tr/td-tag – kwnwzlnd Oct 24 '16 at 08:13
  • That can work, though I probably wouldn't even worry about putting line breaks in the html. (Or if I did want the source code to look pretty, I'd use `vbCrLf` rather than `chr(13)`.) – Martha Oct 24 '16 at 14:28