[AccessD] Building classes for tables

Steve Conklin developer at ultradnt.com
Wed Nov 16 14:52:49 CST 2005


>>Of course the wizard will not build the Init()  functions or surrounding
code.
Why not? Cant we loop the fields and build it as well? With similar
psudo-code as I wrote in my message?

How about we build one section at time - decalrations, then init,
processing, then term.
Module: basBuildRecordClass
Dim mRst as dao.recordset ' 
Dim mstDeclares as string

Sub BuildClass
	set mrst=currentdb.openrecordset(" sql string here")
	DoDeclare
End sub

Private sub DoDeclare
mstDeclares = _
"Private mdb As DAO.Database " & vbcrlf & _ 
"Private mstrQry As String       'The query name of any " & vbcrlf & _ 
"Private mstrSQLCode As String   'The SQL or vb code if any " & vbcrlf & _ 
"Private mstrDescription As String   'The description of the operation " &
vbcrlf & _ 
"Private mstrType As String      'Qry, VBA, SQL " & vbcrlf & _ 
"Private mblnExecute As Boolean  'This is an execute query " & vbcrlf & _ 
"Private mstrQryType As String   'SEL;DEL;UPD;APP " & vbcrlf & _ 

For each fld is rs.fields
	mstdeclares = mstDeclares &  "Private " &  getTypePrefix & fld.name
& " as "  & getTypeString & vbcrlf
Next 'fld

End sub

Now need the 2 functions of select case for the prefix and var. types.

S.





More information about the AccessD mailing list