Article ID: 113949
Article Last Modified on 1/8/2003
Sub Command1_Click ()
Dim DB As Database
Dim DS As Dynaset
Set DB=OpenDatabase("C:\VB\BIBLIO.MDB")
Set DS=DB.CreateDynaset("Authors")
Debug.Print DS("Author").GetChunk(0,50) ' fieldname's type <> memo
End Sub
Sub Command1_Click ()
Const DB_MEMO = 12
Dim DB As Database
Dim DS As Dynaset
Set DB=OpenDatabase("C:\VB\BIBLIO.MDB")
Set DS=DB.CreateDynaset("Authors")
If DB.TableDefs("Authors").Fields("Author").Type = DB_MEMO Then
Debug.Print DS("Author").GetChunk(0,50)
Else
Form1.Print "Wrong Field Type"
End If
End Sub
Or replace it with the following if you are using a Data control:
Sub Command1_Click ()
Const DB_MEMO = 12
Data1.Databasename = "C:\VB\BIBLIO.MDB"
Data1.RecordSource = "Authors"
Data1.Refresh
' Enter the following two lines as one, single line:
If Data1.Database.TableDefs("Authors").Fields("Author").Type =
DB_MEMO Then
Debug.Print Data1.RecordSet("Author").GetChunk(0,50)
Else
Form1.Print "Wrong Field Type"
End If
End Sub
This code will avoid using the inappropriate GetChunk method on the
Author field because its type is DB_TEXT (value 10).Additional query words: 3.00 GPF
Keywords: kbprb KB113949