Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Command Button not working on form - HELP!!!

Command Button not working on form - HELP!!!
Piperlynne 12/31/2008 8:45:01 PM
I have 3 tables - Customer, Brand and Item. Each table is associated to a
form. the field Customer Code is on each table and provides the relationship
between the three tables. On the Item table, the brand name is selected from
the brandname field on the Brand table (i.e. the brand must exist in order to
add products to it.)
On each form I have an Add, Duplicate, Save button as well as buttons that
open the specified form filtered for off information on the item. My problem
is that I can pull up Brand and Item information when using the Customer
form. And I can pull up Brand and Customer information when using the Item
form. However NONE of the buttons on the Brand Form are working. I'm sure I'm
missing something.
Here's the code:
Option Compare Database

Private Sub ShowProdfrmBrd_Click()
On Error GoTo Err_ShowProdfrmBrd_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmItem"

stLinkCriteria = "[BrandName]=" & "'" & Me![Customer_Brand] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_ShowProdfrmBrd_Click:
Exit Sub

Err_ShowProdfrmBrd_Click:
MsgBox Err.Description
Resume Exit_ShowProdfrmBrd_Click

End Sub
Private Sub ShowCustbyBrand_Click()
On Error GoTo Err_ShowCustbyBrand_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmCustomer"

stLinkCriteria = "[Profitability_Code]=" & Me![Profitability_Code]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_ShowCustbyBrand_Click:
Exit Sub

Err_ShowCustbyBrand_Click:
MsgBox Err.Description
Resume Exit_ShowCustbyBrand_Click

End Sub
Private Sub AddBrand_Click()
On Error GoTo Err_AddBrand_Click


DoCmd.GoToRecord , , acNewRec

Exit_AddBrand_Click:
Exit Sub

Err_AddBrand_Click:
MsgBox Err.Description
Resume Exit_AddBrand_Click

End Sub
Private Sub DupBrand_Click()
On Error GoTo Err_DupBrand_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append

Exit_DupBrand_Click:
Exit Sub

Err_DupBrand_Click:
MsgBox Err.Description
Resume Exit_DupBrand_Click

End Sub


Any one see anything I'm missing on why this isn't working. The error
message I'm getting is "The expresssion On Click you entered as the event
property setting producted the following error: Object or class does not
support the set of events.
Re: Command Button not working on form - HELP!!!
Marshall Barton <marshbarton[ at ]wowway.com> 12/31/2008 9:21:54 PM
Piperlynne wrote:

[Quoted Text]
>I have 3 tables - Customer, Brand and Item. Each table is associated to a
>form. the field Customer Code is on each table and provides the relationship
>between the three tables. On the Item table, the brand name is selected from
>the brandname field on the Brand table (i.e. the brand must exist in order to
>add products to it.)
>On each form I have an Add, Duplicate, Save button as well as buttons that
>open the specified form filtered for off information on the item. My problem
>is that I can pull up Brand and Item information when using the Customer
>form. And I can pull up Brand and Customer information when using the Item
>form. However NONE of the buttons on the Brand Form are working. I'm sure I'm
>missing something.
>Here's the code:
>Option Compare Database
>
>Private Sub ShowProdfrmBrd_Click()
>On Error GoTo Err_ShowProdfrmBrd_Click
>
> Dim stDocName As String
> Dim stLinkCriteria As String
>
> stDocName = "frmItem"
>
> stLinkCriteria = "[BrandName]=" & "'" & Me![Customer_Brand] & "'"
> DoCmd.OpenForm stDocName, , , stLinkCriteria
>
>Exit_ShowProdfrmBrd_Click:
> Exit Sub
>
>Err_ShowProdfrmBrd_Click:
> MsgBox Err.Description
> Resume Exit_ShowProdfrmBrd_Click
>
>End Sub
>Private Sub ShowCustbyBrand_Click()
>On Error GoTo Err_ShowCustbyBrand_Click
>
> Dim stDocName As String
> Dim stLinkCriteria As String
>
> stDocName = "frmCustomer"
>
> stLinkCriteria = "[Profitability_Code]=" & Me![Profitability_Code]
> DoCmd.OpenForm stDocName, , , stLinkCriteria
>
>Exit_ShowCustbyBrand_Click:
> Exit Sub
>
>Err_ShowCustbyBrand_Click:
> MsgBox Err.Description
> Resume Exit_ShowCustbyBrand_Click
>
>End Sub
>Private Sub AddBrand_Click()
>On Error GoTo Err_AddBrand_Click
>
>
> DoCmd.GoToRecord , , acNewRec
>
>Exit_AddBrand_Click:
> Exit Sub
>
>Err_AddBrand_Click:
> MsgBox Err.Description
> Resume Exit_AddBrand_Click
>
>End Sub
>Private Sub DupBrand_Click()
>On Error GoTo Err_DupBrand_Click
>
>
> DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
> DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
> DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
>
>Exit_DupBrand_Click:
> Exit Sub
>
>Err_DupBrand_Click:
> MsgBox Err.Description
> Resume Exit_DupBrand_Click
>
>End Sub
>
>
>Any one see anything I'm missing on why this isn't working. The error
>message I'm getting is "The expresssion On Click you entered as the event
>property setting producted the following error: Object or class does not
>support the set of events.


Make sure that the event **property** (for each event you
are using) contains:
[Event Procedure]

Then make sure the module compiles without error (use the
Debug - Compile menu item)

--
Marsh
MVP [MS Access]
Re: Command Button not working on form - HELP!!!
Piperlynne 12/31/2008 9:58:01 PM
each event property has the event procedure on click and I am currently
running the compile now. It's almost as if the form isn't recognizing the
table, even though the table is in the properties correctly. . . .

"Marshall Barton" wrote:

[Quoted Text]
> Piperlynne wrote:
>
> >I have 3 tables - Customer, Brand and Item. Each table is associated to a
> >form. the field Customer Code is on each table and provides the relationship
> >between the three tables. On the Item table, the brand name is selected from
> >the brandname field on the Brand table (i.e. the brand must exist in order to
> >add products to it.)
> >On each form I have an Add, Duplicate, Save button as well as buttons that
> >open the specified form filtered for off information on the item. My problem
> >is that I can pull up Brand and Item information when using the Customer
> >form. And I can pull up Brand and Customer information when using the Item
> >form. However NONE of the buttons on the Brand Form are working. I'm sure I'm
> >missing something.
> >Here's the code:
> >Option Compare Database
> >
> >Private Sub ShowProdfrmBrd_Click()
> >On Error GoTo Err_ShowProdfrmBrd_Click
> >
> > Dim stDocName As String
> > Dim stLinkCriteria As String
> >
> > stDocName = "frmItem"
> >
> > stLinkCriteria = "[BrandName]=" & "'" & Me![Customer_Brand] & "'"
> > DoCmd.OpenForm stDocName, , , stLinkCriteria
> >
> >Exit_ShowProdfrmBrd_Click:
> > Exit Sub
> >
> >Err_ShowProdfrmBrd_Click:
> > MsgBox Err.Description
> > Resume Exit_ShowProdfrmBrd_Click
> >
> >End Sub
> >Private Sub ShowCustbyBrand_Click()
> >On Error GoTo Err_ShowCustbyBrand_Click
> >
> > Dim stDocName As String
> > Dim stLinkCriteria As String
> >
> > stDocName = "frmCustomer"
> >
> > stLinkCriteria = "[Profitability_Code]=" & Me![Profitability_Code]
> > DoCmd.OpenForm stDocName, , , stLinkCriteria
> >
> >Exit_ShowCustbyBrand_Click:
> > Exit Sub
> >
> >Err_ShowCustbyBrand_Click:
> > MsgBox Err.Description
> > Resume Exit_ShowCustbyBrand_Click
> >
> >End Sub
> >Private Sub AddBrand_Click()
> >On Error GoTo Err_AddBrand_Click
> >
> >
> > DoCmd.GoToRecord , , acNewRec
> >
> >Exit_AddBrand_Click:
> > Exit Sub
> >
> >Err_AddBrand_Click:
> > MsgBox Err.Description
> > Resume Exit_AddBrand_Click
> >
> >End Sub
> >Private Sub DupBrand_Click()
> >On Error GoTo Err_DupBrand_Click
> >
> >
> > DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
> > DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
> > DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
> >
> >Exit_DupBrand_Click:
> > Exit Sub
> >
> >Err_DupBrand_Click:
> > MsgBox Err.Description
> > Resume Exit_DupBrand_Click
> >
> >End Sub
> >
> >
> >Any one see anything I'm missing on why this isn't working. The error
> >message I'm getting is "The expresssion On Click you entered as the event
> >property setting producted the following error: Object or class does not
> >support the set of events.
>
>
> Make sure that the event **property** (for each event you
> are using) contains:
> [Event Procedure]
>
> Then make sure the module compiles without error (use the
> Debug - Compile menu item)
>
> --
> Marsh
> MVP [MS Access]
>
Re: Command Button not working on form - HELP!!!
Marshall Barton <marshbarton[ at ]wowway.com> 12/31/2008 11:56:21 PM
To answer your specific question, No, I don't see anything
in the code that could cause that error. The error implies
the most likely problem is that you either have something
odd in an OnClick property or the code will not compile.

Note that the link criteria you are using will fail if there
is an apostrophe in the Customer_Brand text box or field.

You may be using the words in a casual way, but they do not
convey the detailed information needed to help you figure
out what is wrong. The OnClick ***property*** for each
command button must contain:
[Event Procedure]

The compile must complete without any error messages.

I do not understand what "the table is in the properties
correctly" means. Which property in which object?
--
Marsh
MVP [MS Access]


Piperlynne wrote:
[Quoted Text]
>each event property has the event procedure on click and I am currently
>running the compile now. It's almost as if the form isn't recognizing the
>table, even though the table is in the properties correctly. . . .
>
>"Marshall Barton" wrote:
>
>> Piperlynne wrote:
>>
>> >I have 3 tables - Customer, Brand and Item. Each table is associated to a
>> >form. the field Customer Code is on each table and provides the relationship
>> >between the three tables. On the Item table, the brand name is selected from
>> >the brandname field on the Brand table (i.e. the brand must exist in order to
>> >add products to it.)
>> >On each form I have an Add, Duplicate, Save button as well as buttons that
>> >open the specified form filtered for off information on the item. My problem
>> >is that I can pull up Brand and Item information when using the Customer
>> >form. And I can pull up Brand and Customer information when using the Item
>> >form. However NONE of the buttons on the Brand Form are working. I'm sure I'm
>> >missing something.
>> >Here's the code:
>> >Option Compare Database
>> >
>> >Private Sub ShowProdfrmBrd_Click()
[snip]
>> >
>> >Any one see anything I'm missing on why this isn't working. The error
>> >message I'm getting is "The expresssion On Click you entered as the event
>> >property setting producted the following error: Object or class does not
>> >support the set of events.
>>
>>
>> Make sure that the event **property** (for each event you
>> are using) contains:
>> [Event Procedure]
>>
>> Then make sure the module compiles without error (use the
>> Debug - Compile menu item)

Home | Search | Terms | Imprint
Newsgroups Reader