I have a linked SQL Server Database that uses a guid as one of the keys in an Access 2010 DB. I need to write a function that takes the guid as a parameter. Runs a query that sums a numeric field and returns that sum to the query. What I can't figure out is how do I set the Parameter Type to ReplicationID? If I import a portion of the table Access defines the field as ReplicationID but when I put ReplicationID in the code it errors?
Public Function Member_Mnths(ByRef PCPKey As ????) As Long
Dim strsql As String, rs As New ADODB.Recordset
strsql = "SELECT Sum(a.CURRMM) AS MM " & _
"FROM dbo_RVS_CAP_MM_HIST a INNER JOIN tbl_HPCODEs ON a.HPCODE = tbl_HPCODEs.HPCODE " & _
"Where a.pcp_keyid = " & PCPKey & " AND CVDate(a.capmonth & " / 1 / " & a.capyear) between #" & _
DateAdd("m", -7, CVDate(Month(Now()) & "/01/" & Year(Now()))) & "# AND #" & DateAdd("d", -1, DataAdd("m", -1, CVDate(Month(Now()) & "/01/" & Year(Now())))) & _
"# "
rs.Open strsql, CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
If rs.EOF Then Member_Mnths = 0 Else Member_Mnths = rs!MM
rs.Close
Set rs = Nothing
End Function