P
Piperlynne
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.
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.