pullmyefinger
Registered User.
- Local time
- Today, 11:13
- Joined
- Feb 26, 2011
- Messages
- 37
NEW: the command (next, prev record) buttons don't seem to be the issue. they were commented out and the form still won't Open from the menu OR manually.
WHEN I try to manually run the form i get a message that basically says:
The expression on open as the event property setting produced the following error: Procedure Declaration does not match description of event or procedure having the same name.
there is a main menu that has a cmd button "edit or del records". when i click that button I get the error msg above.
the on open event has one line that says "DoCmd.OpenForm ("Edit")
this worked before, there is a form called Edit, spelled exactly that way. I know you don't always get the statement causing the error all the time, but this is stupid or I did something stupid that I forgot about.
Please look at the code and see what's what? I can't fig it out.
trying to use an edit form that has worked fine with docmd.openform("Edit")
until I realized that the end user won't be looking at the current record or BOF or EOF.
i understand the error message that comes up, but she won't and she will panic. besides, if i can write code to prevent that from happening that is what should be done anyway.
after adding the code below, every time i try to open the form, access gives me the aforementioned error and says the openform action was cancelled. this is the only thing i added, so i need to know if i did something stupid and that is causing the problem??
PS: The form won't open manually or via the code. It keeps saying the on open event "did not resolve" to a vba event or some control and that i need to check spelling. I cannot find anything wrong.
Private Sub NextRecBtn_Click()
Dim currentrec, lastrec As Long, numrows As Integer
Me.Refresh
numrows = DCount("*", "EQPT")
lastrec = numrows
currentrec = frm.CurrentRecord (should be current rec in EQPT table)
If numrows = 1 Then
Me.NextRecBtn.Enabled = False
ElseIf currentrec = numrows Then
Me.NextRecBtn.Enabled = False
Else
Me.NextRecBtn.Enabled = True
DoCmd.RunCommand acCmdRecordsGoToNext
End If
End Sub
All i want to do is to enable/disable the next and previous record command buttons at the appropriate times. my logic is that if the current record is the last record, then disable the next record button. also, if the current record is record 1, disable the previous record button, and if neither condition is true enable both buttons.
WHEN I try to manually run the form i get a message that basically says:
The expression on open as the event property setting produced the following error: Procedure Declaration does not match description of event or procedure having the same name.
there is a main menu that has a cmd button "edit or del records". when i click that button I get the error msg above.
the on open event has one line that says "DoCmd.OpenForm ("Edit")
this worked before, there is a form called Edit, spelled exactly that way. I know you don't always get the statement causing the error all the time, but this is stupid or I did something stupid that I forgot about.
Please look at the code and see what's what? I can't fig it out.
trying to use an edit form that has worked fine with docmd.openform("Edit")
until I realized that the end user won't be looking at the current record or BOF or EOF.
i understand the error message that comes up, but she won't and she will panic. besides, if i can write code to prevent that from happening that is what should be done anyway.
after adding the code below, every time i try to open the form, access gives me the aforementioned error and says the openform action was cancelled. this is the only thing i added, so i need to know if i did something stupid and that is causing the problem??
PS: The form won't open manually or via the code. It keeps saying the on open event "did not resolve" to a vba event or some control and that i need to check spelling. I cannot find anything wrong.
Private Sub NextRecBtn_Click()
Dim currentrec, lastrec As Long, numrows As Integer
Me.Refresh
numrows = DCount("*", "EQPT")
lastrec = numrows
currentrec = frm.CurrentRecord (should be current rec in EQPT table)
If numrows = 1 Then
Me.NextRecBtn.Enabled = False
ElseIf currentrec = numrows Then
Me.NextRecBtn.Enabled = False
Else
Me.NextRecBtn.Enabled = True
DoCmd.RunCommand acCmdRecordsGoToNext
End If
End Sub
All i want to do is to enable/disable the next and previous record command buttons at the appropriate times. my logic is that if the current record is the last record, then disable the next record button. also, if the current record is record 1, disable the previous record button, and if neither condition is true enable both buttons.
Attachments
Last edited: