How do you define a field as memo in code

marathonlady

Registered User.
Local time
Today, 16:22
Joined
Jul 10, 2002
Messages
120
Is there a way to define a memo field in code? I don't see 'memo' as an item in the list when you go to define a variable.

Thanks in advance for any help.
 
Hi -

If you're wanting to create a table that includes a memo field, give this a try:
Code:
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

HTH - Bob
 

Users who are viewing this thread

Back
Top Bottom