I have the following code that works in a form, but I need to have work on a Data Access Page, the DCount does not work, anyone know an alternative? (Departments is a table and Password is a field) And will DoCmd work in the Data Access Page scripting?

Dim intChkPword
strPassword = InputBox "Enter the Department Password you recieved:"
intChkPword = DCount("*", "Departments", "[Password] = '" & strPassword & "'")
If intChkPword = 0 Then
MsgBox prompt:="Invalid Entry"
DoCmd.OpenReport "Permit", , , "[Permit ID]=" & Me.txtPermitID
End If

(I attached the database as well, Page2 is the page I'm working with)