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 |
#11
|
|||
|
|||
main form/subform/command button for another subform
"[ProgressID]= "
-- S "Klatuu" wrote: 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 |
#12
|
|||
|
|||
main form/subform/command button for another subform
That means there is nothing in Me![ProgressID]
-- Dave Hargis, Microsoft Access MVP "Sharon" wrote: "[ProgressID]= " -- S "Klatuu" wrote: 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 | |
|
|