Hi,
I have developed a form in SLX that inserts multiple records into the history table at once. Everything works except that these records will not synch over to the remote offices. I am not sure what I am missing. My form calls a history class that was used in other code with my own modifications. Here is the class:
Any help would be greatly appreciated as I have hit a brick wall with this.
Option Explicit
Class History Private m_type Private m_conId Private m_startDT Private m_completedDT Private m_userID Private m_desc Private m_category Private m_notes Private m_historyID
Private Sub Class_Initialize() m_userID = Application.BasicFunctions.CurrentUserID End Sub
'Here are the "writable" Let properties Public Property Let HistoryType(ByVal val) m_type = val End Property
Public Property Let ContactID(ByVal val) m_conId = val End Property
Public Property Let StartDate(ByVal val) m_startDT = val End Property
Public Property Let CompletedDate(ByVal val) m_completedDT = val End Property
Public Property Let UserID(ByVal val) m_userID = val End Property
Public Property Let Description(ByVal val) m_desc = val End Property
Public Property Let Category(ByVal val) m_category = val End Property
Public Property Let Notes(ByVal val) m_notes = val End Property
'Here are the "readable" Get properties Public Property Get HistoryID HistoryID = m_historyID End Property
Public Sub Add Dim cn Dim i Dim counter Dim rs
Set cn = Application.GetNewConnection
Set rs = cn.Execute("select count(username) from sysdba.username")
counter = rs.Fields(0).Value & ""
for i=1 to counter m_historyID = GetNewID("history") next
cn.Execute GetInsertSQL()
cn.Execute("delete from sysdba.webcast") cn.Execute("delete from sysdba.username")
rs.Close Set rs = Nothing cn.Close Set cn = Nothing End Sub
Private Function GetInsertSQL() Dim sql
sql = "insert into history (historyid, type, accountid, accountname," sql = sql & "contactid, contactname, startdate, userid, timeless, duration," sql = sql & "description, category, notes, longnotes, createuser, createdate, completeduser, completeddate)" sql = sql & "select " sql = sql & "a.historyid," sql = sql & "'" & m_type & "', " sql = sql & "b.accountid," sql = sql & "b.account," sql = sql & "b.contactid," sql = sql & "b.lastname + ', ' + b.firstname," sql = sql & "'" & m_startDT & "', " sql = sql & "'" & m_userID & "', " sql = sql & "'T', " sql = sql & "'0', " sql = sql & "'" & Replace(m_desc, "'", "''") & "', " sql = sql & "'" & Replace(m_category, "'", "''") & "', " sql = sql & "'" & Replace(Mid(m_notes, 1, 254), "'", "''") & "', " sql = sql & "'" & Replace(m_notes, "'", "''") & "', " sql = sql & "'" & Application.BasicFunctions.CurrentUserID & "', " sql = sql & "'" & GetANSIDate(Now) & "', " sql = sql & "'" & m_userID & "', " sql = sql & "'" & m_completedDT & "' " sql = sql & "from Webcast_View a inner join sysdba.contact b on a.username = b.webusername"
GetInsertSQL = sql End Function
Private Function GetNewID(ByVal table) Dim rs Dim cn
Set cn = Application.GetNewConnection Set rs = cn.Execute("slx_dbids('" & table & "', 1)")
GetNewID = rs.Fields(0).Value & "" cn.Execute ("insert into webcast (historyid) values ('" & GetNewID & "')")
rs.Close Set rs = Nothing cn.Close Set cn = Nothing End Function
End Class |