Hi,
I'm currently tasked with converting a Access 2.0 Database to Access 2013 and have run into a wall with the form code. It was written in Access 2.0 and I keep getting errors when navigating through the forms. I have pasted a snippet of code from one of the buttons that is causing the issue. Whenever I click the button associated with the issue(there are several buttons with similar problems), it pops up an error saying: "Compile error: Method or data member not found". It then high lights the .[Cup] section of code in the If Response =6 Then subblock. Can someone please help me?
I'm currently tasked with converting a Access 2.0 Database to Access 2013 and have run into a wall with the form code. It was written in Access 2.0 and I keep getting errors when navigating through the forms. I have pasted a snippet of code from one of the buttons that is causing the issue. Whenever I click the button associated with the issue(there are several buttons with similar problems), it pops up an error saying: "Compile error: Method or data member not found". It then high lights the .[Cup] section of code in the If Response =6 Then subblock. Can someone please help me?
Code:
Private Sub Button41_Click()
On Error GoTo Err_Button41_Click
DoCmd.Hourglass True
Dim MyDB As Database, MYRECORDS As Recordset, Xcounter As Integer
Dim SELECTEDPROCESS As String
SELECTEDPROCESS = "'" & Forms![PROCESS INFORMATION]![SELEWWFPROCESS].Form![PROCESS] & "'"
Xcounter = 0
selectedproject = [LLPROJECT]
Set MyDB = DBEngine.Workspaces(0).Databases(0)
MYRECORDScrit = "SELECT SELEPROC.LLPROJECT, SELEPROC.PROCESS, SELEPROC.POLLNAME, SELEPROC.FORMULA_FORMAT, SELEPROC.Cup, SELEPROC.Reference FROM SELEPROC WHERE ((SELEPROC.LLPROJECT = " & [LLPROJECT] & ") AND (SELEPROC.PROCESS = " & SELECTEDPROCESS & "))"
'MsgBox MYRECORDScrit
Set MYRECORDS = MyDB.OpenRecordset(MYRECORDScrit, DB_OPEN_DYNASET)
If MYRECORDS.BOF Then
MsgBox "No pollutants records to check. Press enter or click to return to form.", , "LLIDS - Intelligence in action!"
DoCmd.Hourglass False
'Exit Sub
Else
MYRECORDS.MoveFirst
MYRECORDS.MoveLast
End If
'searchcrit = "Cup = 0"
searchcrit = "((Cup = 0) OR (ISNULL(Cup)))"
MYRECORDS.FindFirst searchcrit
If MYRECORDS.NoMatch Then
'DO NOTHING
Else
Response = MsgBox("There are " + Trim(Str(MYRECORDS.RecordCount)) + " records. Delete any pollutants with Cup = 0 before closing screen?", 4, "LLIDS - Intelligence in action!")
'RESPONSE=6 MEANS YES
If Response = 6 Then
MYRECORDS.MoveFirst
Do Until MYRECORDS.EOF
If ((MYRECORDS[B].[Cup][/B] = 0) Or (IsNull(MYRECORDS.[Cup]))) Then
MYRECORDS.Delete
End If
MYRECORDS.MoveNext
Loop
Else
Response = MsgBox("No records checked or deleted. Please note that entries without a defined Cup value should be deleted. Return to form?", 4, "LLIDS - Intelligence in action!")
If Response = 6 Then
DoCmd.Hourglass False
Exit Sub
End If
End If
End If
PROJECTNUMBER = [LLPROJECT]
DoCmd.Hourglass False
DoCmd.Close
Forms![LLIDS Main Menu].Visible = True
Exit_Button41_Click:
Exit Sub
Err_Button41_Click:
MsgBox Error$
Resume Exit_Button41_Click
End Sub
Last edited: