Hi guys!
I have written a word macro to access the sqlserver database
and retrieve data from a table. It looks like it works
fine with out any errors except it does not print the
retrieved records on to word document.
Here is the code,
Sub Macro()
Set objMstConn = CreateObject("ADODB.Connection"
objMstConn.Open "DSN=dsn;UID=id;PWD=pd"
Set objRS2 = CreateObject("ADODB.Recordset"
SQLRoleUser = "select col1, col2 from table1"
objRS2.Open SQLRoleUser, objMstConn
Do While Not objRS2.EOF
FieldValue1 = Trim(objRS2("col1")
FieldValue2 = Trim(objRS2("col2")
objRS2.MoveNext
Loop
End Sub
What am I missing here, SqlServer Gurus's help me out here.
Thanks In Advance.
VNK
I have written a word macro to access the sqlserver database
and retrieve data from a table. It looks like it works
fine with out any errors except it does not print the
retrieved records on to word document.
Here is the code,
Sub Macro()
Set objMstConn = CreateObject("ADODB.Connection"
objMstConn.Open "DSN=dsn;UID=id;PWD=pd"
Set objRS2 = CreateObject("ADODB.Recordset"
SQLRoleUser = "select col1, col2 from table1"
objRS2.Open SQLRoleUser, objMstConn
Do While Not objRS2.EOF
FieldValue1 = Trim(objRS2("col1")
FieldValue2 = Trim(objRS2("col2")
objRS2.MoveNext
Loop
End Sub
What am I missing here, SqlServer Gurus's help me out here.
Thanks In Advance.
VNK