J
JRS
I asked this question and did not get a response so I am trying again. I
have a command button on a form. A parameter query is link to form so when
you open the form you are prompted for a group, subgroup and pkg number. The
command button was in case you wanted to request a different group from the
opened form. I created the command and once prompted for the same info...the
form goes blank and you have to manually go into records and hit the filter
sort to see the data. I wanted some code to automate that. I have read
other notes and tried to do what was reccomended however I must be putting it
in the wrong place as I have not got it to work. I am pasting the command
code....could you place the code where it belongs in the paste so I can see
exactly? thanks
Option Compare Database
Private Sub Command68_Click()
On Error GoTo Err_Command68_Click
Dim stDocName As String
stDocName = "FORM QUERY"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Command68_Click:
Exit Sub
Err_Command68_Click:
MsgBox Err.Description
Resume Exit_Command68_Click
End Sub
Private Sub Command71_Click()
On Error GoTo Err_Command71_Click
DoCmd.Quit
Exit_Command71_Click:
Exit Sub
Err_Command71_Click:
MsgBox Err.Description
Resume Exit_Command71_Click
End Sub
Private Sub Command73_Click()
On Error GoTo Err_Command73_Click
DoCmd.PrintOut
Exit_Command73_Click:
Exit Sub
Err_Command73_Click:
MsgBox Err.Description
Resume Exit_Command73_Click
End Sub
Private Sub Command74_Click()
On Error GoTo Err_Command74_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_Command74_Click:
Exit Sub
Err_Command74_Click:
MsgBox Err.Description
Resume Exit_Command74_Click
End Sub
Private Sub Command75_Click()
On Error GoTo Err_Command75_Click
DoCmd.Quit
Exit_Command75_Click:
Exit Sub
Err_Command75_Click:
MsgBox Err.Description
Resume Exit_Command75_Click
End Sub
Private Sub GROUP_NUMBER_ONLY_Click()
On Error GoTo Err_GROUP_NUMBER_ONLY_Click
Dim stDocName As String
stDocName = "FORM QUERY GROUP NUMBER ONLY"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_GROUP_NUMBER_ONLY_Click:
Exit Sub
Err_GROUP_NUMBER_ONLY_Click:
MsgBox Err.Description
Resume Exit_GROUP_NUMBER_ONLY_Click
End Sub
Private Sub query_by_group_number_only_Click()
On Error GoTo Err_query_by_group_number_only_Click
Dim stDocName As String
stDocName = "QUERY GROUP NUMBER ONLY"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_query_by_group_number_only_Click:
Exit Sub
Err_query_by_group_number_only_Click:
MsgBox Err.Description
Resume Exit_query_by_group_number_only_Click
End Sub
Private Sub Query_by_Group_Name_Click()
On Error GoTo Err_Query_by_Group_Name_Click
Dim stDocName As String
stDocName = "QUERY BY GROUP NAME"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Query_by_Group_Name_Click:
Exit Sub
Err_Query_by_Group_Name_Click:
MsgBox Err.Description
Resume Exit_Query_by_Group_Name_Click
End Sub
Private Sub Command85_Click()
On Error GoTo Err_Command85_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PROGRAM INFORMATION"
stLinkCriteria = "[PKG_NBR]=" & "'" & Me![PKG_NBR] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command85_Click:
Exit Sub
Err_Command85_Click:
MsgBox Err.Description
Resume Exit_Command85_Click
End Sub
have a command button on a form. A parameter query is link to form so when
you open the form you are prompted for a group, subgroup and pkg number. The
command button was in case you wanted to request a different group from the
opened form. I created the command and once prompted for the same info...the
form goes blank and you have to manually go into records and hit the filter
sort to see the data. I wanted some code to automate that. I have read
other notes and tried to do what was reccomended however I must be putting it
in the wrong place as I have not got it to work. I am pasting the command
code....could you place the code where it belongs in the paste so I can see
exactly? thanks
Option Compare Database
Private Sub Command68_Click()
On Error GoTo Err_Command68_Click
Dim stDocName As String
stDocName = "FORM QUERY"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Command68_Click:
Exit Sub
Err_Command68_Click:
MsgBox Err.Description
Resume Exit_Command68_Click
End Sub
Private Sub Command71_Click()
On Error GoTo Err_Command71_Click
DoCmd.Quit
Exit_Command71_Click:
Exit Sub
Err_Command71_Click:
MsgBox Err.Description
Resume Exit_Command71_Click
End Sub
Private Sub Command73_Click()
On Error GoTo Err_Command73_Click
DoCmd.PrintOut
Exit_Command73_Click:
Exit Sub
Err_Command73_Click:
MsgBox Err.Description
Resume Exit_Command73_Click
End Sub
Private Sub Command74_Click()
On Error GoTo Err_Command74_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_Command74_Click:
Exit Sub
Err_Command74_Click:
MsgBox Err.Description
Resume Exit_Command74_Click
End Sub
Private Sub Command75_Click()
On Error GoTo Err_Command75_Click
DoCmd.Quit
Exit_Command75_Click:
Exit Sub
Err_Command75_Click:
MsgBox Err.Description
Resume Exit_Command75_Click
End Sub
Private Sub GROUP_NUMBER_ONLY_Click()
On Error GoTo Err_GROUP_NUMBER_ONLY_Click
Dim stDocName As String
stDocName = "FORM QUERY GROUP NUMBER ONLY"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_GROUP_NUMBER_ONLY_Click:
Exit Sub
Err_GROUP_NUMBER_ONLY_Click:
MsgBox Err.Description
Resume Exit_GROUP_NUMBER_ONLY_Click
End Sub
Private Sub query_by_group_number_only_Click()
On Error GoTo Err_query_by_group_number_only_Click
Dim stDocName As String
stDocName = "QUERY GROUP NUMBER ONLY"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_query_by_group_number_only_Click:
Exit Sub
Err_query_by_group_number_only_Click:
MsgBox Err.Description
Resume Exit_query_by_group_number_only_Click
End Sub
Private Sub Query_by_Group_Name_Click()
On Error GoTo Err_Query_by_Group_Name_Click
Dim stDocName As String
stDocName = "QUERY BY GROUP NAME"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Query_by_Group_Name_Click:
Exit Sub
Err_Query_by_Group_Name_Click:
MsgBox Err.Description
Resume Exit_Query_by_Group_Name_Click
End Sub
Private Sub Command85_Click()
On Error GoTo Err_Command85_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PROGRAM INFORMATION"
stLinkCriteria = "[PKG_NBR]=" & "'" & Me![PKG_NBR] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command85_Click:
Exit Sub
Err_Command85_Click:
MsgBox Err.Description
Resume Exit_Command85_Click
End Sub