K
Ken Warthen
I have an Access 2007 application in which I'm creating a custom ribbon. I
have a callback module in which there is a routine called onOpenForm. Within
the routine there is a select case statement where code is executed based on
the calling ribbon button. I'm having trouble with one of Case statements
where I need to both open a form and call the click event of a command button
on the form. Here is the relevant code:
Case "btnEnterProject"
If (CurrentProject.AllForms("frmProjects").IsLoaded) Then
Forms!frmProjects.SetFocus
Forms!frmProjects.cmdAddProject_Click
Else
DoCmd.OpenForm "frmProjects", acNormal
Forms!frmProjects.SetFocus
Forms!frmProjects.cmdAddProject_Click
End If
When I run the code I get an error message #2465, "Application-defined or
object-defined error." If anyone can tell me what I'm doing wrong here, I
would be very appreciative.
Ken
have a callback module in which there is a routine called onOpenForm. Within
the routine there is a select case statement where code is executed based on
the calling ribbon button. I'm having trouble with one of Case statements
where I need to both open a form and call the click event of a command button
on the form. Here is the relevant code:
Case "btnEnterProject"
If (CurrentProject.AllForms("frmProjects").IsLoaded) Then
Forms!frmProjects.SetFocus
Forms!frmProjects.cmdAddProject_Click
Else
DoCmd.OpenForm "frmProjects", acNormal
Forms!frmProjects.SetFocus
Forms!frmProjects.cmdAddProject_Click
End If
When I run the code I get an error message #2465, "Application-defined or
object-defined error." If anyone can tell me what I'm doing wrong here, I
would be very appreciative.
Ken