Sub tabletest(pTable As String)
'*******************************************
'Purpose: Delete/recreate table programmaically
'from: raskew
'Input: from debug (immediate) window
' call tabletest("tempTest")
'*******************************************
Dim strSQL As String
On Error Resume Next
'WARNING: Table pTable will be deleted,
' and recreated. If this is
' a problem, choose another,
' unique table name.
CurrentDb.Execute "DROP TABLE " & pTable & ";"
strSQL = "CREATE TABLE " & pTable & " " _
& "( PlayerNo Integer Not Null" _
& ", LastName Text(25) Not Null" _
& ", Initials Text(5) Not Null" _
& ", DOB DateTime" _
& ", Sex Text(1) Not Null" _
& ", Joined Integer" _
& ", Street Text(15) Not Null" _
& ", HouseNo Text(4)" _
& ", Postcode Text(6)" _
& ", Town Text(10) Not Null" _
& ", PhoneNo Text(10)" _
& ", LeagueNo Text(4)" _
& ", Remarks Memo" _
& " )"
CurrentDb.Execute strSQL
CurrentDb.TableDefs.Refresh
End Sub