If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
main form/subform/command button for another subform
I am using Microsoft Access 2003.
I have the following three tables: 1. tblToDo ToDoID (pk) ToDoCategoryID ToDoActionID DueBy DocketNumber ToDoInstructionsID ProgressID 2. tblToDoInstructions ToDoInstructionsID (pk) DoDoInstructions ToDoID ProgressID 3. tblToDoProgress ProgressID (pk) CompletedDate ProgressNotes Done ToDoID ToDoInstructionsID I am trying to create a form using the tblToDo information as the main form, the tblToDoInstructions as a subform (preferably continuous as there are different steps to accomplish the task) and a command button that opens Progress notes for each instruction. The main form (tblToDo) is linked to the subform through the ToDoID. I created a command button on the subfrmToDoInstructions to open the subform subfrmToDoProgressNotes. Private Sub cmdbtnProgressNotes_Click() On Error GoTo Err_cmdbtnProgressNotes_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "subfrmToDoProgress" stLinkCriteria = "[ProgressID]" = " & Me![ProgressID]" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_cmdbtnProgressNotes_Click: Exit Sub Err_cmdbtnProgressNotes_Click: MsgBox Err.Description Resume Exit_cmdbtnProgressNotes_Click End Sub My problem is that when I select the command button, it opens the subfrmToDoProgress but the fields for ToDoInstructionsID and ToDoID are "0". How do I link these IDs so that the subforms will pull up the corresponding records. Any help is appreciated. -- S |
#2
|
|||
|
|||
main form/subform/command button for another subform
Two options:
first try: stLinkCriteria = "[ProgressID]" = " & Me![ProgressID] lose the double quotes at the end second: Your filter could reference the mainform. The way it is setup now it's referencing the subform. try: stLinkCriteria = "[ProgressID]" = " & Me.parent![ProgressID] -- Maurice Ausum "Sharon" wrote: I am using Microsoft Access 2003. I have the following three tables: 1. tblToDo ToDoID (pk) ToDoCategoryID ToDoActionID DueBy DocketNumber ToDoInstructionsID ProgressID 2. tblToDoInstructions ToDoInstructionsID (pk) DoDoInstructions ToDoID ProgressID 3. tblToDoProgress ProgressID (pk) CompletedDate ProgressNotes Done ToDoID ToDoInstructionsID I am trying to create a form using the tblToDo information as the main form, the tblToDoInstructions as a subform (preferably continuous as there are different steps to accomplish the task) and a command button that opens Progress notes for each instruction. The main form (tblToDo) is linked to the subform through the ToDoID. I created a command button on the subfrmToDoInstructions to open the subform subfrmToDoProgressNotes. Private Sub cmdbtnProgressNotes_Click() On Error GoTo Err_cmdbtnProgressNotes_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "subfrmToDoProgress" stLinkCriteria = "[ProgressID]" = " & Me![ProgressID]" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_cmdbtnProgressNotes_Click: Exit Sub Err_cmdbtnProgressNotes_Click: MsgBox Err.Description Resume Exit_cmdbtnProgressNotes_Click End Sub My problem is that when I select the command button, it opens the subfrmToDoProgress but the fields for ToDoInstructionsID and ToDoID are "0". How do I link these IDs so that the subforms will pull up the corresponding records. Any help is appreciated. -- S |
#3
|
|||
|
|||
main form/subform/command button for another subform
to link the subform data to the mainform data, use the Link Master/Child
fields properties of the subform controls. Rather than a button to open the 3rd table, why not a sub form for the sub form? It is allowed. -- Dave Hargis, Microsoft Access MVP "Sharon" wrote: I am using Microsoft Access 2003. I have the following three tables: 1. tblToDo ToDoID (pk) ToDoCategoryID ToDoActionID DueBy DocketNumber ToDoInstructionsID ProgressID 2. tblToDoInstructions ToDoInstructionsID (pk) DoDoInstructions ToDoID ProgressID 3. tblToDoProgress ProgressID (pk) CompletedDate ProgressNotes Done ToDoID ToDoInstructionsID I am trying to create a form using the tblToDo information as the main form, the tblToDoInstructions as a subform (preferably continuous as there are different steps to accomplish the task) and a command button that opens Progress notes for each instruction. The main form (tblToDo) is linked to the subform through the ToDoID. I created a command button on the subfrmToDoInstructions to open the subform subfrmToDoProgressNotes. Private Sub cmdbtnProgressNotes_Click() On Error GoTo Err_cmdbtnProgressNotes_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "subfrmToDoProgress" stLinkCriteria = "[ProgressID]" = " & Me![ProgressID]" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_cmdbtnProgressNotes_Click: Exit Sub Err_cmdbtnProgressNotes_Click: MsgBox Err.Description Resume Exit_cmdbtnProgressNotes_Click End Sub My problem is that when I select the command button, it opens the subfrmToDoProgress but the fields for ToDoInstructionsID and ToDoID are "0". How do I link these IDs so that the subforms will pull up the corresponding records. Any help is appreciated. -- S |
#4
|
|||
|
|||
main form/subform/command button for another subform
Maurice, thanks so much for your response.
I tried to lose the quotes at the end, but the they were automatically put back in? -- S "Maurice" wrote: Two options: first try: stLinkCriteria = "[ProgressID]" = " & Me![ProgressID] lose the double quotes at the end second: Your filter could reference the mainform. The way it is setup now it's referencing the subform. try: stLinkCriteria = "[ProgressID]" = " & Me.parent![ProgressID] -- Maurice Ausum "Sharon" wrote: I am using Microsoft Access 2003. I have the following three tables: 1. tblToDo ToDoID (pk) ToDoCategoryID ToDoActionID DueBy DocketNumber ToDoInstructionsID ProgressID 2. tblToDoInstructions ToDoInstructionsID (pk) DoDoInstructions ToDoID ProgressID 3. tblToDoProgress ProgressID (pk) CompletedDate ProgressNotes Done ToDoID ToDoInstructionsID I am trying to create a form using the tblToDo information as the main form, the tblToDoInstructions as a subform (preferably continuous as there are different steps to accomplish the task) and a command button that opens Progress notes for each instruction. The main form (tblToDo) is linked to the subform through the ToDoID. I created a command button on the subfrmToDoInstructions to open the subform subfrmToDoProgressNotes. Private Sub cmdbtnProgressNotes_Click() On Error GoTo Err_cmdbtnProgressNotes_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "subfrmToDoProgress" stLinkCriteria = "[ProgressID]" = " & Me![ProgressID]" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_cmdbtnProgressNotes_Click: Exit Sub Err_cmdbtnProgressNotes_Click: MsgBox Err.Description Resume Exit_cmdbtnProgressNotes_Click End Sub My problem is that when I select the command button, it opens the subfrmToDoProgress but the fields for ToDoInstructionsID and ToDoID are "0". How do I link these IDs so that the subforms will pull up the corresponding records. Any help is appreciated. -- S |
#5
|
|||
|
|||
main form/subform/command button for another subform
should be:
stLinkCriteria = "[ProgressID] = " & Me![ProgressID] Assuming [ProgressID] is a numeric field. If it is a text field, it would be: stLinkCriteria = "[ProgressID] = '" & Me![ProgressID] & "'" -- Dave Hargis, Microsoft Access MVP "Sharon" wrote: Maurice, thanks so much for your response. I tried to lose the quotes at the end, but the they were automatically put back in? -- S "Maurice" wrote: Two options: first try: stLinkCriteria = "[ProgressID]" = " & Me![ProgressID] lose the double quotes at the end second: Your filter could reference the mainform. The way it is setup now it's referencing the subform. try: stLinkCriteria = "[ProgressID]" = " & Me.parent![ProgressID] -- Maurice Ausum "Sharon" wrote: I am using Microsoft Access 2003. I have the following three tables: 1. tblToDo ToDoID (pk) ToDoCategoryID ToDoActionID DueBy DocketNumber ToDoInstructionsID ProgressID 2. tblToDoInstructions ToDoInstructionsID (pk) DoDoInstructions ToDoID ProgressID 3. tblToDoProgress ProgressID (pk) CompletedDate ProgressNotes Done ToDoID ToDoInstructionsID I am trying to create a form using the tblToDo information as the main form, the tblToDoInstructions as a subform (preferably continuous as there are different steps to accomplish the task) and a command button that opens Progress notes for each instruction. The main form (tblToDo) is linked to the subform through the ToDoID. I created a command button on the subfrmToDoInstructions to open the subform subfrmToDoProgressNotes. Private Sub cmdbtnProgressNotes_Click() On Error GoTo Err_cmdbtnProgressNotes_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "subfrmToDoProgress" stLinkCriteria = "[ProgressID]" = " & Me![ProgressID]" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_cmdbtnProgressNotes_Click: Exit Sub Err_cmdbtnProgressNotes_Click: MsgBox Err.Description Resume Exit_cmdbtnProgressNotes_Click End Sub My problem is that when I select the command button, it opens the subfrmToDoProgress but the fields for ToDoInstructionsID and ToDoID are "0". How do I link these IDs so that the subforms will pull up the corresponding records. Any help is appreciated. -- S |
#6
|
|||
|
|||
main form/subform/command button for another subform
Klatuu, I appreciate your response but it won't let me have a continuous
form with a subform. See the "depiction" below which hopefully will give you a better idea of what I am trying to do. frmToDo - Prepare and file a certain document a. subfrmToDoInstruction - Prepare document i. Progress Notes - Prepared document on 5/23/07 ii. Progress Notes - Sent draft to attorney for approval iii. Progress Notes - Received approval on 5/23/07 b. Instruction - File with patent office i. Progress Notes - Filed with the patent office on 5/24/07 c. Instruction - Copies to Client i. Progress Notes - Copies have been sent to all of the clients ii. Progress Notes - Copy in the file and indexed. -- S "Klatuu" wrote: to link the subform data to the mainform data, use the Link Master/Child fields properties of the subform controls. Rather than a button to open the 3rd table, why not a sub form for the sub form? It is allowed. -- Dave Hargis, Microsoft Access MVP "Sharon" wrote: I am using Microsoft Access 2003. I have the following three tables: 1. tblToDo ToDoID (pk) ToDoCategoryID ToDoActionID DueBy DocketNumber ToDoInstructionsID ProgressID 2. tblToDoInstructions ToDoInstructionsID (pk) DoDoInstructions ToDoID ProgressID 3. tblToDoProgress ProgressID (pk) CompletedDate ProgressNotes Done ToDoID ToDoInstructionsID I am trying to create a form using the tblToDo information as the main form, the tblToDoInstructions as a subform (preferably continuous as there are different steps to accomplish the task) and a command button that opens Progress notes for each instruction. The main form (tblToDo) is linked to the subform through the ToDoID. I created a command button on the subfrmToDoInstructions to open the subform subfrmToDoProgressNotes. Private Sub cmdbtnProgressNotes_Click() On Error GoTo Err_cmdbtnProgressNotes_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "subfrmToDoProgress" stLinkCriteria = "[ProgressID]" = " & Me![ProgressID]" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_cmdbtnProgressNotes_Click: Exit Sub Err_cmdbtnProgressNotes_Click: MsgBox Err.Description Resume Exit_cmdbtnProgressNotes_Click End Sub My problem is that when I select the command button, it opens the subfrmToDoProgress but the fields for ToDoInstructionsID and ToDoID are "0". How do I link these IDs so that the subforms will pull up the corresponding records. Any help is appreciated. -- S |
#7
|
|||
|
|||
main form/subform/command button for another subform
Klatuu, I have substituted the strLinkCriteria line as you indicated, but I
keep getting the error message: Syntax error (missing operator) in query expression '[ProgressID]='. btw - Progress ID is an autonumber. Thanks. -- S "Klatuu" wrote: should be: stLinkCriteria = "[ProgressID] = " & Me![ProgressID] Assuming [ProgressID] is a numeric field. If it is a text field, it would be: stLinkCriteria = "[ProgressID] = '" & Me![ProgressID] & "'" -- Dave Hargis, Microsoft Access MVP "Sharon" wrote: Maurice, thanks so much for your response. I tried to lose the quotes at the end, but the they were automatically put back in? -- S "Maurice" wrote: Two options: first try: stLinkCriteria = "[ProgressID]" = " & Me![ProgressID] lose the double quotes at the end second: Your filter could reference the mainform. The way it is setup now it's referencing the subform. try: stLinkCriteria = "[ProgressID]" = " & Me.parent![ProgressID] -- Maurice Ausum "Sharon" wrote: I am using Microsoft Access 2003. I have the following three tables: 1. tblToDo ToDoID (pk) ToDoCategoryID ToDoActionID DueBy DocketNumber ToDoInstructionsID ProgressID 2. tblToDoInstructions ToDoInstructionsID (pk) DoDoInstructions ToDoID ProgressID 3. tblToDoProgress ProgressID (pk) CompletedDate ProgressNotes Done ToDoID ToDoInstructionsID I am trying to create a form using the tblToDo information as the main form, the tblToDoInstructions as a subform (preferably continuous as there are different steps to accomplish the task) and a command button that opens Progress notes for each instruction. The main form (tblToDo) is linked to the subform through the ToDoID. I created a command button on the subfrmToDoInstructions to open the subform subfrmToDoProgressNotes. Private Sub cmdbtnProgressNotes_Click() On Error GoTo Err_cmdbtnProgressNotes_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "subfrmToDoProgress" stLinkCriteria = "[ProgressID]" = " & Me![ProgressID]" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_cmdbtnProgressNotes_Click: Exit Sub Err_cmdbtnProgressNotes_Click: MsgBox Err.Description Resume Exit_cmdbtnProgressNotes_Click End Sub My problem is that when I select the command button, it opens the subfrmToDoProgress but the fields for ToDoInstructionsID and ToDoID are "0". How do I link these IDs so that the subforms will pull up the corresponding records. Any help is appreciated. -- S |
#8
|
|||
|
|||
main form/subform/command button for another subform
Post the code you are actually using, please.
-- Dave Hargis, Microsoft Access MVP "Sharon" wrote: Klatuu, I have substituted the strLinkCriteria line as you indicated, but I keep getting the error message: Syntax error (missing operator) in query expression '[ProgressID]='. btw - Progress ID is an autonumber. Thanks. -- S "Klatuu" wrote: should be: stLinkCriteria = "[ProgressID] = " & Me![ProgressID] Assuming [ProgressID] is a numeric field. If it is a text field, it would be: stLinkCriteria = "[ProgressID] = '" & Me![ProgressID] & "'" -- Dave Hargis, Microsoft Access MVP "Sharon" wrote: Maurice, thanks so much for your response. I tried to lose the quotes at the end, but the they were automatically put back in? -- S "Maurice" wrote: Two options: first try: stLinkCriteria = "[ProgressID]" = " & Me![ProgressID] lose the double quotes at the end second: Your filter could reference the mainform. The way it is setup now it's referencing the subform. try: stLinkCriteria = "[ProgressID]" = " & Me.parent![ProgressID] -- Maurice Ausum "Sharon" wrote: I am using Microsoft Access 2003. I have the following three tables: 1. tblToDo ToDoID (pk) ToDoCategoryID ToDoActionID DueBy DocketNumber ToDoInstructionsID ProgressID 2. tblToDoInstructions ToDoInstructionsID (pk) DoDoInstructions ToDoID ProgressID 3. tblToDoProgress ProgressID (pk) CompletedDate ProgressNotes Done ToDoID ToDoInstructionsID I am trying to create a form using the tblToDo information as the main form, the tblToDoInstructions as a subform (preferably continuous as there are different steps to accomplish the task) and a command button that opens Progress notes for each instruction. The main form (tblToDo) is linked to the subform through the ToDoID. I created a command button on the subfrmToDoInstructions to open the subform subfrmToDoProgressNotes. Private Sub cmdbtnProgressNotes_Click() On Error GoTo Err_cmdbtnProgressNotes_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "subfrmToDoProgress" stLinkCriteria = "[ProgressID]" = " & Me![ProgressID]" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_cmdbtnProgressNotes_Click: Exit Sub Err_cmdbtnProgressNotes_Click: MsgBox Err.Description Resume Exit_cmdbtnProgressNotes_Click End Sub My problem is that when I select the command button, it opens the subfrmToDoProgress but the fields for ToDoInstructionsID and ToDoID are "0". How do I link these IDs so that the subforms will pull up the corresponding records. Any help is appreciated. -- S |
#9
|
|||
|
|||
main form/subform/command button for another subform
This is the code for the command button.
Private Sub cmdbtnProgressNotes_Click() On Error GoTo Err_cmdbtnProgressNotes_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "subfrmToDoProgress" stLinkCriteria = "[ProgressID] = " & Me![ProgressID] DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_cmdbtnProgressNotes_Click: Exit Sub Err_cmdbtnProgressNotes_Click: MsgBox Err.Description Resume Exit_cmdbtnProgressNotes_Click End Sub -- S "Klatuu" wrote: to link the subform data to the mainform data, use the Link Master/Child fields properties of the subform controls. Rather than a button to open the 3rd table, why not a sub form for the sub form? It is allowed. -- Dave Hargis, Microsoft Access MVP "Sharon" wrote: I am using Microsoft Access 2003. I have the following three tables: 1. tblToDo ToDoID (pk) ToDoCategoryID ToDoActionID DueBy DocketNumber ToDoInstructionsID ProgressID 2. tblToDoInstructions ToDoInstructionsID (pk) DoDoInstructions ToDoID ProgressID 3. tblToDoProgress ProgressID (pk) CompletedDate ProgressNotes Done ToDoID ToDoInstructionsID I am trying to create a form using the tblToDo information as the main form, the tblToDoInstructions as a subform (preferably continuous as there are different steps to accomplish the task) and a command button that opens Progress notes for each instruction. The main form (tblToDo) is linked to the subform through the ToDoID. I created a command button on the subfrmToDoInstructions to open the subform subfrmToDoProgressNotes. Private Sub cmdbtnProgressNotes_Click() On Error GoTo Err_cmdbtnProgressNotes_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "subfrmToDoProgress" stLinkCriteria = "[ProgressID]" = " & Me![ProgressID]" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_cmdbtnProgressNotes_Click: Exit Sub Err_cmdbtnProgressNotes_Click: MsgBox Err.Description Resume Exit_cmdbtnProgressNotes_Click End Sub My problem is that when I select the command button, it opens the subfrmToDoProgress but the fields for ToDoInstructionsID and ToDoID are "0". How do I link these IDs so that the subforms will pull up the corresponding records. Any help is appreciated. -- S |
#10
|
|||
|
|||
main form/subform/command button for another subform
What is the value of Me!ProgressID at the time of assignment?
Put a breakpoint on this line: DoCmd.OpenForm stDocName, , , stLinkCriteria run the code. When it gets to this line, see what the value of strLinkCriteria is. -- Dave Hargis, Microsoft Access MVP "Sharon" wrote: This is the code for the command button. Private Sub cmdbtnProgressNotes_Click() On Error GoTo Err_cmdbtnProgressNotes_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "subfrmToDoProgress" stLinkCriteria = "[ProgressID] = " & Me![ProgressID] DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_cmdbtnProgressNotes_Click: Exit Sub Err_cmdbtnProgressNotes_Click: MsgBox Err.Description Resume Exit_cmdbtnProgressNotes_Click End Sub -- S "Klatuu" wrote: to link the subform data to the mainform data, use the Link Master/Child fields properties of the subform controls. Rather than a button to open the 3rd table, why not a sub form for the sub form? It is allowed. -- Dave Hargis, Microsoft Access MVP "Sharon" wrote: I am using Microsoft Access 2003. I have the following three tables: 1. tblToDo ToDoID (pk) ToDoCategoryID ToDoActionID DueBy DocketNumber ToDoInstructionsID ProgressID 2. tblToDoInstructions ToDoInstructionsID (pk) DoDoInstructions ToDoID ProgressID 3. tblToDoProgress ProgressID (pk) CompletedDate ProgressNotes Done ToDoID ToDoInstructionsID I am trying to create a form using the tblToDo information as the main form, the tblToDoInstructions as a subform (preferably continuous as there are different steps to accomplish the task) and a command button that opens Progress notes for each instruction. The main form (tblToDo) is linked to the subform through the ToDoID. I created a command button on the subfrmToDoInstructions to open the subform subfrmToDoProgressNotes. Private Sub cmdbtnProgressNotes_Click() On Error GoTo Err_cmdbtnProgressNotes_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "subfrmToDoProgress" stLinkCriteria = "[ProgressID]" = " & Me![ProgressID]" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_cmdbtnProgressNotes_Click: Exit Sub Err_cmdbtnProgressNotes_Click: MsgBox Err.Description Resume Exit_cmdbtnProgressNotes_Click End Sub My problem is that when I select the command button, it opens the subfrmToDoProgress but the fields for ToDoInstructionsID and ToDoID are "0". How do I link these IDs so that the subforms will pull up the corresponding records. Any help is appreciated. -- S |
|
Thread Tools | |
Display Modes | |
|
|