[AccessD] BE builder

Stuart McLachlan stuart at lexacorp.com.pg
Sat Jul 16 15:20:20 CDT 2011


Quick one of the top of my head:   Obviously you need would probably want to add indexes 
and do some error checking as well.

Option Compare Database
Option Explicit

Const BEName As String = "GameTimer.mdb"

Function CheckBE()
If Dir$(CurrentProject.Path & "\" & BEName) = "" Then CreateBE
End Function

Function CreateBE() As Long
Dim wrkDefault As Workspace
Dim dbsNew As Database
Dim tdfNew As TableDef
   
   Set wrkDefault = DBEngine.Workspaces(0)
   Set dbsNew = wrkDefault.CreateDatabase(CurrentProject.Path & "\" & BEName, 
dbLangGeneral)
   Set tdfNew = dbsNew.CreateTableDef("tblGameTimes")
   With tdfNew
      .Fields.Append .CreateField("StartDateTime", dbDate)
      .Fields.Append .CreateField("ElapsedTime", dbLong)
      .Fields.Append .CreateField("Game", dbText)
   End With
   dbsNew.TableDefs.Append tdfNew
   dbsNew.Close
End Function


On 16 Jul 2011 at 14:46, jwcolby wrote:

> I need an ultra simple BE builder.  I have built my little game play
> logger for my son.  It logs the time he starts and stops and plays a
> wave file - more and more often - to remind and encourage him to get
> off when his time is up.
> 
> It only has a couple of simple tables, but it would be nice to split
> FE/BE so that if I fix a problem or add a feature I can update the FE.
>  Ya know!
> 
> It would be nice to have the program open and check if the BE exists,
> creating it if not.  Placing the BE in the same dir as the FE would be
> fine.
> 
> I can of course write that but if anyone has such a thing already that
> would be better.  I did it long ago but it is lost in the deep shadows
> of the last century.
> 
> Anyone?
> -- 
> John W. Colby
> www.ColbyConsulting.com
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 






More information about the AccessD mailing list