Hi again,
I must be missing something stupid as this command appeared to work before. I am trying to find the next number in sequence based upon three variables but it fails to compile with a compile error of "Method or data member not found".
I have checked the exact names / spelling of all variables against the table and the actual form but there doesn't appear to be anything wrong. The code is
"
Private Sub Combo55_AfterUpdate()
Dim nNextReq As Long
Dim SQL As String
Dim strUser As String
NextReq = 0
NextReq = DMax("Req_No", "tbl_Requirements", ("Req_Area = " & Me.Req_Area & " AND Req_Type = " & Me.Req_Type & " AND Req_Dept = " & Me.Req_Dept))
If IsNull(NextReq) Then NextReq = 0
NextReq = NextReq + 1
Me!Req_No = NextReq
strSQL = "Insert into tbl_Requirements (Req_Area, Req_Dept, Req_Type, Req_No) values (Forms!frm_Requirements!Req_Area, Forms!frm_Requirements!Req_Dept, Forms!frm_Requirements!Req_Type, '& NextReq &')"
End Sub"
Any help would be appreciated. Thanks
I must be missing something stupid as this command appeared to work before. I am trying to find the next number in sequence based upon three variables but it fails to compile with a compile error of "Method or data member not found".
I have checked the exact names / spelling of all variables against the table and the actual form but there doesn't appear to be anything wrong. The code is
"
Private Sub Combo55_AfterUpdate()
Dim nNextReq As Long
Dim SQL As String
Dim strUser As String
NextReq = 0
NextReq = DMax("Req_No", "tbl_Requirements", ("Req_Area = " & Me.Req_Area & " AND Req_Type = " & Me.Req_Type & " AND Req_Dept = " & Me.Req_Dept))
If IsNull(NextReq) Then NextReq = 0
NextReq = NextReq + 1
Me!Req_No = NextReq
strSQL = "Insert into tbl_Requirements (Req_Area, Req_Dept, Req_Type, Req_No) values (Forms!frm_Requirements!Req_Area, Forms!frm_Requirements!Req_Dept, Forms!frm_Requirements!Req_Type, '& NextReq &')"
End Sub"
Any help would be appreciated. Thanks