handlebarry
Technical User
Hi - trying to workout how to open a form if a criteria is matched. Using earlier strings I have come up with:
Dim stDocName As String
Dim strSQL As String
Dim strSQLWhere As String
Dim lngCount As Long
Dim strHelp As String
Dim crlf As String
stDocName = "frmContractDetails"
strHelp = "This Property has no contracts"
strSQL = "SELECT * FROM tblContractsToProperties"
strSQLWhere = ((tblContractsToProperties.GIS_Property_Code) = [Forms]![frmProperty]![txtGIS_Property_Code])
strSQL = strSQL & " WHERE " & strSQLWhere
lngCount = FindRecord(strSQL)
If lngCount = 0 Then Message = MsgBox(strHelp, vbExclamation)
Else
DoCmd.OpenForm stDocName
The code gets as far FindRecord - sub or function not defined
Can someone please advise as to whether this is the best method and if so how to define FindRecord
thanks
Dim stDocName As String
Dim strSQL As String
Dim strSQLWhere As String
Dim lngCount As Long
Dim strHelp As String
Dim crlf As String
stDocName = "frmContractDetails"
strHelp = "This Property has no contracts"
strSQL = "SELECT * FROM tblContractsToProperties"
strSQLWhere = ((tblContractsToProperties.GIS_Property_Code) = [Forms]![frmProperty]![txtGIS_Property_Code])
strSQL = strSQL & " WHERE " & strSQLWhere
lngCount = FindRecord(strSQL)
If lngCount = 0 Then Message = MsgBox(strHelp, vbExclamation)
Else
DoCmd.OpenForm stDocName
The code gets as far FindRecord - sub or function not defined
Can someone please advise as to whether this is the best method and if so how to define FindRecord
thanks