R
Ray
I have a test file I used to show that a particular technique for generating
letters and incorporating data from a database would work. This called a
routine 'SaveDocs':
Sub SaveDocs()
CreateDocs printmode:=False, savemode:=True
End Sub
Private Sub CreateDocs(printmode As Boolean, savemode As Boolean)
Dim objConn As New Connection
Dim objRS As New Recordset
objConn.ConnectionString = c_DBCon
objConn.Open
objRS.Open c_SQL, objConn
Do While Not objRS.EOF
CreateDoc objRS, printmode, savemode
objRS.MoveNext
Loop
objRS.Close
objConn.Close
End Sub
Where c_DBCon and c_sql are global constants (text) which contain the
database information and SQL query respectively. CreateDoc is another Private
Sub that creates a letter from a singe recordset. This worked, and still
works fine. I am using exactly the same code in another document (with a
different CreateDoc routine) but I now get a compile error stating that 'A
user defined datatype is not defined' in the line:
Dim objConn As New Connection
In neither case have I defined a datatype for objConn (Recordset is also not
recognised as a datatype in the module). Is there another possible reason
this error message could be generated?
Thanks for any suggestions.
Ray
letters and incorporating data from a database would work. This called a
routine 'SaveDocs':
Sub SaveDocs()
CreateDocs printmode:=False, savemode:=True
End Sub
Private Sub CreateDocs(printmode As Boolean, savemode As Boolean)
Dim objConn As New Connection
Dim objRS As New Recordset
objConn.ConnectionString = c_DBCon
objConn.Open
objRS.Open c_SQL, objConn
Do While Not objRS.EOF
CreateDoc objRS, printmode, savemode
objRS.MoveNext
Loop
objRS.Close
objConn.Close
End Sub
Where c_DBCon and c_sql are global constants (text) which contain the
database information and SQL query respectively. CreateDoc is another Private
Sub that creates a letter from a singe recordset. This worked, and still
works fine. I am using exactly the same code in another document (with a
different CreateDoc routine) but I now get a compile error stating that 'A
user defined datatype is not defined' in the line:
Dim objConn As New Connection
In neither case have I defined a datatype for objConn (Recordset is also not
recognised as a datatype in the module). Is there another possible reason
this error message could be generated?
Thanks for any suggestions.
Ray