O
onedaywhen
Like all good posters to this newsgroup I've read Chip's hints and
tips and try to follow them. I want to provide sample data and I
definitely don't want to encourage the posting of workbooks as
attachments.
If, like me, anyone here reads the database newsgroups they will be
familiar with a guy called Joe Celko and his signature:
"Please post DDL, so that people do not have to guess
what the keys, constraints, Declarative Referential
Integrity, datatypes, etc. in your schema are."
Data Definition Language (DDL) statements (CREATE TABLE..., INSERT
INTO..., etc) allow the reader to actually create the poster's
database simply by pasting the DLL into their database system and
pressing a button.
Recently, I was asked in this newsgroup for an example workbook and,
rather than send them an email and take the discussion outside the
group, I posted the following instructions on how to create my example
workbook:
"Open a new workbook, insert a standard module and paste in the
following sub procedure:
Public Sub CreateDB()
Dim ws As Excel.Worksheet
Application.DisplayAlerts = False
On Error Resume Next
ThisWorkbook.Worksheets("Database").Delete
On Error GoTo 0
Application.DisplayAlerts = True
Set ws = ThisWorkbook.Worksheets.Add
With ws
ws.Name = "Database"
.Range("A1:C1").Value = Array("RefID", "Surname", "Balance")
.Range("A2:A11").Value = Application.Transpose(Array(1, _
2, 3, 4, 5, 6, 7, 8, 9, 10))
.Range("B2:B11").Value = Application.Transpose(Array("Nan", _
"Wet", "Ren", "Hip", _
"Nat", "Ter", "Doh", _
"Leh", "Rot", "Ton"))
.Range("C2:C11").Value = Application.Transpose(Array(Int(Rnd *
99), _
Int(Rnd * 99), Int(Rnd * 99), _
Int(Rnd * 99), Int(Rnd * 99), _
Int(Rnd * 99), Int(Rnd * 99), _
Int(Rnd * 99), Int(Rnd * 99), _
Int(Rnd * 99)))
End With
ThisWorkbook.Names.Add "Data", "=Database!$A$2:$C$11"
End Sub
And it struck me that I've never seen this kind of thing in this
newsgroup before. Usually, sample data is given in the text of post,
like this:
RefID Surname
----- -------
1 Nan
2 Wet
3 Ren
...
Even if it survives the various formatting it undergoes during the
posting process (e.g. via Google groups or Developer Network) I'm
rarely able to copy and paste it into a workbook.
I'm sure I'd be more willing to help someone if they provided me with
a quick and easy method to re-create their data, formulas, defined
Names, etc. And when I say easy, I essentially mean copy+paste and
press a button.
What do people here think? Are you frustrated with the way sample data
and workbooks are provided in this newsgroup? If you saw my CreateDB
routine in a posting, would you appreciate it as a short cut to seeing
my sample workbook? Or would you possibly dismiss it, for example
because it makes my posting look *more* complicated rather than
simplifying things?
I'd appreciate any views you may have.
tips and try to follow them. I want to provide sample data and I
definitely don't want to encourage the posting of workbooks as
attachments.
If, like me, anyone here reads the database newsgroups they will be
familiar with a guy called Joe Celko and his signature:
"Please post DDL, so that people do not have to guess
what the keys, constraints, Declarative Referential
Integrity, datatypes, etc. in your schema are."
Data Definition Language (DDL) statements (CREATE TABLE..., INSERT
INTO..., etc) allow the reader to actually create the poster's
database simply by pasting the DLL into their database system and
pressing a button.
Recently, I was asked in this newsgroup for an example workbook and,
rather than send them an email and take the discussion outside the
group, I posted the following instructions on how to create my example
workbook:
"Open a new workbook, insert a standard module and paste in the
following sub procedure:
Public Sub CreateDB()
Dim ws As Excel.Worksheet
Application.DisplayAlerts = False
On Error Resume Next
ThisWorkbook.Worksheets("Database").Delete
On Error GoTo 0
Application.DisplayAlerts = True
Set ws = ThisWorkbook.Worksheets.Add
With ws
ws.Name = "Database"
.Range("A1:C1").Value = Array("RefID", "Surname", "Balance")
.Range("A2:A11").Value = Application.Transpose(Array(1, _
2, 3, 4, 5, 6, 7, 8, 9, 10))
.Range("B2:B11").Value = Application.Transpose(Array("Nan", _
"Wet", "Ren", "Hip", _
"Nat", "Ter", "Doh", _
"Leh", "Rot", "Ton"))
.Range("C2:C11").Value = Application.Transpose(Array(Int(Rnd *
99), _
Int(Rnd * 99), Int(Rnd * 99), _
Int(Rnd * 99), Int(Rnd * 99), _
Int(Rnd * 99), Int(Rnd * 99), _
Int(Rnd * 99), Int(Rnd * 99), _
Int(Rnd * 99)))
End With
ThisWorkbook.Names.Add "Data", "=Database!$A$2:$C$11"
End Sub
And it struck me that I've never seen this kind of thing in this
newsgroup before. Usually, sample data is given in the text of post,
like this:
RefID Surname
----- -------
1 Nan
2 Wet
3 Ren
...
Even if it survives the various formatting it undergoes during the
posting process (e.g. via Google groups or Developer Network) I'm
rarely able to copy and paste it into a workbook.
I'm sure I'd be more willing to help someone if they provided me with
a quick and easy method to re-create their data, formulas, defined
Names, etc. And when I say easy, I essentially mean copy+paste and
press a button.
What do people here think? Are you frustrated with the way sample data
and workbooks are provided in this newsgroup? If you saw my CreateDB
routine in a posting, would you appreciate it as a short cut to seeing
my sample workbook? Or would you possibly dismiss it, for example
because it makes my posting look *more* complicated rather than
simplifying things?
I'd appreciate any views you may have.