in the details format section of a report module, i am generating a runtime error 3061 – too few parameters: expected 2
the line of code where it breaks is as follows:
Set rst = db.OpenRecordset (strSQL)
the entire code for this section is as follows:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim db As DAO.Database
Dim rst As Recordset
Dim strSQL As String
Dim strSpeciality As String
Set db = CurrentDb
If IsNull(Me.MEMID) Then
Me.txtSpeciality = “”
Exit Sub
End If
If Forms!frmoperations!Combo0.Value = 31 Or 32 Then
lblCounty.Visible = True
lblDistrict.Visible = True
Text46.Visible = True
Text47.Visible = True
Else:
lblCounty.Visible = False
lblDistrict.Visible = False
Text46.Visible = False
Text47.Visible = False
End If
strSQL = “SELECT jcttblAfftoMem.MEMID, tblAffiliation.Affiliation ” & _
“FROM tblAffiliation INNER JOIN jcttblAfftoMem ON ” & _
“(tblAffiliation.AffiliationID = jcttblAfftoMem.AffiliationID) AND ” & _
“(tblAffiliation.AffiliationID = jcttblAfftoMem.AffiliationID) ” & _
“WHERE jcttblAfftoMem.MEMID = ” & Me.MEMID
Set rst = db.OpenRecordset(strSQL)
strSpeciality = “”
If rst.RecordCount 0 Then
rst.MoveFirst
Do While Not rst.EOF
strSpeciality = strSpeciality & rst!Affiliation & “, ”
rst.MoveNext
Loop
strSpeciality = Left(strSpeciality, Len(strSpeciality) – 2)
Me.txtSpeciality = strSpeciality
Else
Me.txtSpeciality = “”
End If
End Sub
Can anyone see what parameters it’s looking for? or perhaps there is an extra character that i am not noticing that is making Access think it needs another parameter.
Also, is there an easier way to refer to one property on many controls? like an upside down and backwards With Statement?
any suggestions for improvement will be appreciated.