A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

main form/subform/command button for another subform



 
 
Thread Tools Display Modes
  #11  
Old June 19th, 2007, 08:12 PM posted to microsoft.public.access.forms
Sharon
external usenet poster
 
Posts: 491
Default 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  
Old June 19th, 2007, 08:15 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:42 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.