MOSS 2007 Development

MOSS 2007 Devel

Filter a Dataviewer based on the value of an ASP Control

Sounds easy.

It is if you know how…

Enable code behind on sharepoint aspx pages

in web.config

< PageParserPaths >
< PageParserPath VirtualPath=”/*” CompilationMode=”Always” AllowServerSideScript=”true” IncludeSubFolders=”true” / >
< /PageParserPaths >

Call .NET assembly from COM

Sign the assembly using sn.exe or project properties.

regasm /codebase /tlb:foo.tlb foo.dll
Then in VB6 References, browse to your .tlb file and voila.

References

http://visualbasic.about.com/od/usingvbnet/a/cominterop2_4.htm

http://msdn.microsoft.com/en-us/library/ms973802%28loband%29.aspx

Microsoft Word Mail Merge SQL Server

Sub ConfigureMailMerge(clientId As Long, dsnFile As String, viewName As String)

Debug.Print “Call ConfigureMailMerge(” & Str(clientId) & “, ” & dsnFile & “, ” & viewName & “)”


Dim sql As String
‘sql = “SELECT * FROM ” & viewName & ” WHERE clientid=” & Trim(Str(clientId)) & “”
sql = “SELECT * FROM “”” & viewName & “”” WHERE clientid=” & Trim(Str(clientId)) & “”
‘sql = “SELECT * FROM ” & MYVIEW & ” WHERE clientid='” & Trim(Str(clientId)) & “‘”
Debug.Print sql

Dim sConn As String
sConn = “FILEDSN=” & dsnFile & “;”

ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource _
Name:=dsnFile, _
SQLStatement:=sql

Debug.Print “Datasource Record Count = ” & ActiveDocument.MailMerge.DataSource.RecordCount

Debug.Print “Return ConfigureMailMerge”

End Sub