Newbie >> help

Cameroncha

Registered User.
Local time
Today, 02:00
Joined
Jul 1, 2002
Messages
58
I have to close out Access entirly for Queries and Reports to close

I recieved a message saying that i was refrencing the same thing 2 times in the code for that query.

As a solution (not a very good one at that) i deleted all of the VBA that was created when i used wizards to create buttons that open different forms for editing off of my forms

now, many times i have to close Access altogether to close certain forms / Queries


Help.. ?
 
The VBA you deleted was most likely your close events for your forms. It should not affect your queries as they will still have the close button enabled.

A quick fix. On the on_Click event of your close buttons, choose [event procedure] and just type in docmd.close in the code window. This will allow you to close tour forms again. An alternative is to re-enable the control box and close button on the form's/reports properties.
 
thanks for the advice... i am still getting the error however:
It gives me error 2486

Option Compare Database

Private Sub Form_Click()
DoCmd.Close
End Sub
Private Sub BEditProducer_Click()
On Error GoTo Err_BEditProducer_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_ProducerMaster"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_BEditProducer_Click:
Exit Sub

Err_BEditProducer_Click:
MsgBox Err.Description
Resume Exit_BEditProducer_Click

End Sub
Private Sub Command1_Click()
On Error GoTo Err_Command1_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_ProducerMaster"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command1_Click:
Exit Sub

Err_Command1_Click:
MsgBox Err.Description
Resume Exit_Command1_Click

End Sub
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_DescriptionSeperate"

stLinkCriteria = "[Sku]=" & "'" & Me![SKU] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command2_Click:
Exit Sub

Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click

End Sub
Private Sub Command3_Click()
On Error GoTo Err_Command3_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_ProducerMaster"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command3_Click:
Exit Sub

Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click

End Sub
Private Sub Command4_Click()
On Error GoTo Err_Command4_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_SportMaster"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command4_Click:
Exit Sub

Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click

End Sub
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_CategoryMaster"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command5_Click:
Exit Sub

Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click

End Sub
Private Sub Command7_Click()
On Error GoTo Err_Command7_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_Paths"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command7_Click:
Exit Sub

Err_Command7_Click:
MsgBox Err.Description
Resume Exit_Command7_Click

End Sub
 
The most obvious problem I can see is that you haven't give stLinkCriteria a value in your BEditProducer_Click Proceedure (or anywhere else except for the Command2_Click.


Private Sub BEditProducer_Click()
On Error GoTo Err_BEditProducer_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_ProducerMaster"
DoCmd.OpenForm stDocName, , , stLinkCriteria
 

Users who are viewing this thread

Back
Top Bottom