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  

link subform to other form



 
 
Thread Tools Display Modes
  #1  
Old July 9th, 2004, 04:34 AM
Troy Scott
external usenet poster
 
Posts: n/a
Default link subform to other form

Hello, I am trying to use a subform (which works great so far) to enter
data. I have a one to one relationship on the main form and sub form with
enforce referential integrity selected( cascade update/deleted selected
too). I placed a button in my subform that activates another form where the
user can enter more data. This form is on a separate table as well as the
main and subform. How can I get the popup form data to relate to the main
and subform? I checked enforce referential integrity, cascade update/delete
in my relationship but the data entered is the same for all records. HELP!

TIA

Troy


  #2  
Old July 9th, 2004, 02:33 PM
Ed Robichaud
external usenet poster
 
Posts: n/a
Default link subform to other form

To open another form linked to some value on your current form, include
something like the code below in the on click event that opens the new form:

'================================================= =====
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNewForm"
stLinkCriteria = "[MyID]=" & Forms![frmMainForm].Form![frmMysub]![MyID]

If IsNull(Forms![frmMainForm].Form![frmMysub]![MyValue]) Then
MsgBox "Enter a Record before selecting New Form"
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

'================================================= ====
-Ed

"Troy Scott mindspring.com" tigerweldremovebrakets wrote in message
...
Hello, I am trying to use a subform (which works great so far) to enter
data. I have a one to one relationship on the main form and sub form with
enforce referential integrity selected( cascade update/deleted selected
too). I placed a button in my subform that activates another form where

the
user can enter more data. This form is on a separate table as well as the
main and subform. How can I get the popup form data to relate to the main
and subform? I checked enforce referential integrity, cascade

update/delete
in my relationship but the data entered is the same for all records.

HELP!

TIA

Troy




  #3  
Old July 9th, 2004, 04:09 PM
Troy
external usenet poster
 
Posts: n/a
Default link subform to other form

Why won't it link to the same record like the subform
does?

Troy


-----Original Message-----
To open another form linked to some value on your current

form, include
something like the code below in the on click event that

opens the new form:

'================================================ ======
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNewForm"
stLinkCriteria = "[MyID]=" & Forms![frmMainForm].Form!

[frmMysub]![MyID]

If IsNull(Forms![frmMainForm].Form![frmMysub]!

[MyValue]) Then
MsgBox "Enter a Record before selecting New Form"
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

'================================================ =====
-Ed

"Troy Scott mindspring.com" tigerweldremovebrakets

wrote in message
...
Hello, I am trying to use a subform (which works great

so far) to enter
data. I have a one to one relationship on the main

form and sub form with
enforce referential integrity selected( cascade

update/deleted selected
too). I placed a button in my subform that activates

another form where
the
user can enter more data. This form is on a separate

table as well as the
main and subform. How can I get the popup form data to

relate to the main
and subform? I checked enforce referential integrity,

cascade
update/delete
in my relationship but the data entered is the same for

all records.
HELP!

TIA

Troy




.

  #4  
Old July 9th, 2004, 08:48 PM
external usenet poster
 
Posts: n/a
Default link subform to other form

Hey Ed, I tried that code but I kept getting errors.
Could you possibly be a little more help? My main form is
frmMain, my subform is frmMainSub. Would it be any better
if I place the command button just outside of the
subform? Would that help?

Thanks!

Troy


-----Original Message-----
To open another form linked to some value on your current

form, include
something like the code below in the on click event that

opens the new form:

'================================================ ======
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNewForm"
stLinkCriteria = "[MyID]=" & Forms![frmMainForm].Form!

[frmMysub]![MyID]

If IsNull(Forms![frmMainForm].Form![frmMysub]!

[MyValue]) Then
MsgBox "Enter a Record before selecting New Form"
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

'================================================ =====
-Ed

"Troy Scott mindspring.com" tigerweldremovebrakets

wrote in message
...
Hello, I am trying to use a subform (which works great

so far) to enter
data. I have a one to one relationship on the main

form and sub form with
enforce referential integrity selected( cascade

update/deleted selected
too). I placed a button in my subform that activates

another form where
the
user can enter more data. This form is on a separate

table as well as the
main and subform. How can I get the popup form data to

relate to the main
and subform? I checked enforce referential integrity,

cascade
update/delete
in my relationship but the data entered is the same for

all records.
HELP!

TIA

Troy




.

  #5  
Old July 11th, 2004, 06:57 PM
Ed Robichaud
external usenet poster
 
Posts: n/a
Default link subform to other form

OK; the location of the command button is not that important, but see Access
help for how to reference control names on sub reports/forms. With your
names, it should be:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNewForm"
stLinkCriteria = "[MyID]=" & Forms![frmMain].Form![frmMainsub]![MyID]

If IsNull(Forms![frmMain].Form![frmMaisub]![MyID]) Then
MsgBox "Enter a Record before selecting New Form"
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

'================================================ =====

This should work whether the subform is a single or continuous form, as it
will use what ever record is selected in the subform, then open the new form
with the link criteria. Notr that the new form MUST have a record source
that contains [MyID].

What errors are you getting?

-Ed
wrote in message
...
Hey Ed, I tried that code but I kept getting errors.
Could you possibly be a little more help? My main form is
frmMain, my subform is frmMainSub. Would it be any better
if I place the command button just outside of the
subform? Would that help?

Thanks!

Troy


-----Original Message-----
To open another form linked to some value on your current

form, include
something like the code below in the on click event that

opens the new form:

'================================================ ======
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNewForm"
stLinkCriteria = "[MyID]=" & Forms![frmMainForm].Form!

[frmMysub]![MyID]

If IsNull(Forms![frmMainForm].Form![frmMysub]!

[MyValue]) Then
MsgBox "Enter a Record before selecting New Form"
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

'================================================ =====
-Ed

"Troy Scott mindspring.com" tigerweldremovebrakets

wrote in message
...
Hello, I am trying to use a subform (which works great

so far) to enter
data. I have a one to one relationship on the main

form and sub form with
enforce referential integrity selected( cascade

update/deleted selected
too). I placed a button in my subform that activates

another form where
the
user can enter more data. This form is on a separate

table as well as the
main and subform. How can I get the popup form data to

relate to the main
and subform? I checked enforce referential integrity,

cascade
update/delete
in my relationship but the data entered is the same for

all records.
HELP!

TIA

Troy




.



 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter Problems on Main form & Subform Jeff Using Forms 2 July 7th, 2004 03:13 PM
Pop up form doesn't link correctly, PLEASE HELP!!! Sandra Using Forms 4 June 19th, 2004 01:55 AM
Recordset in subform based on field in parent form Lyn General Discussion 15 June 14th, 2004 03:10 PM
Filter subform combobox on option button in main form Emma Using Forms 1 June 12th, 2004 12:24 AM
Pulling sum of a subform to another form DDarney Using Forms 1 May 26th, 2004 07:01 PM


All times are GMT +1. The time now is 06:24 PM.


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