Criteria for opening form from a different subform

  • Thread starter Scott_Brasted via AccessMonster.com
  • Start date
S

Scott_Brasted via AccessMonster.com

Form: frmCamPledgeList
Subform: frmCamPledgeListSub
Double click on field in subform to open
Form: frmViewDonor

DoCmd.OpenForm "frmViewDonor", , , "tblContributors.[ContributorID] =" &
Forms!frmCamPledgeList!frmCamPledgeListSub.idContributorID - gives me a 438
error, object doesn't support this property or method; and

DoCmd.OpenForm "frmViewDonor", , , "tblContributors.[ContributorID] =" &
Forms!frmCamPledgeList!frmCamPledgeListSub.Form.idContributorID - gives me
the filtered result on the first record and a blank form on all subsequent
records.

Does anyone have an idea of what is wrong?

Thanks,
Scott
 
C

Crystal (strive4peace)

Hi Scott,

*** Difference between Subform Control and Subform ***

The first click on a subform control puts handles* around
the subform object.
*black squares in the corners and the middle of each size --
resizing handles

The subform object has properties such as

Name
SourceObject
LinkMasterFields
LinkChildFields
Visible
Locked
Left
Top
Width
Height

the subform control is just a container for the subform.

the subform itself is an independent form -- you can open it
directly from the database window and it has the same
properties of the main form. It is only called a subform
because of the way it is being used.

To summarize, when you are in the design view of the main
form, the first click on the subform is the subform control
-- you will see the handles around the edges -- and the
second click gets you INTO it -- you will see a black square
where the rulers intersect in the upper left of the "form"
you are "in" (and this is the same as if you went to the
design directly)

me.subform.controlname --> the subform control
me.subform.controlname.form --> the form inside the subform
control

Personally, I edit subforms directly, not from inside the
main form -- I have had trouble with Access putting property
changes in the wrong place for RowSources and RecordSource.
Since it happens there occassionally, for major changes, I
go to the design view of the "sub"form directly from the
databse window when the main form is closed.
the subform itself is an independent form -- you can open it
directly from the database window and it has the same
properties of the main form. It is only called a subform
because of the way it is being used.

To summarize, when you are in the design view of the main
form, the first click on the subform is the subform control
-- you will see the handles around the edges -- and the
second click gets you INTO it -- you will see a black square
where the rulers intersect in the upper left of the "form"
you are "in" (and this is the same as if you went to the
design directly)

me.subform.controlname --> the subform control
me.subform.controlname.form --> the form inside the subform
control

Personally, I edit subforms directly, not from inside the
main form -- I have had trouble with Access putting property
changes in the wrong place for RowSources and RecordSource.
Since it happens there occassionally, for major changes, I
go to the design view of the "sub"form directly from the
databse window when the main form is closed.

~~~

that said, it looks like you may need this:

Forms!frmCamPledgeList!frmCamPledgeListSub.form.idContributorID

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*


Scott_Brasted via AccessMonster.com said:
Form: frmCamPledgeList
Subform: frmCamPledgeListSub
Double click on field in subform to open
Form: frmViewDonor

DoCmd.OpenForm "frmViewDonor", , , "tblContributors.[ContributorID] =" &
Forms!frmCamPledgeList!frmCamPledgeListSub.idContributorID - gives me a 438
error, object doesn't support this property or method; and

DoCmd.OpenForm "frmViewDonor", , , "tblContributors.[ContributorID] =" &
Forms!frmCamPledgeList!frmCamPledgeListSub.Form.idContributorID - gives me
the filtered result on the first record and a blank form on all subsequent
records.

Does anyone have an idea of what is wrong?

Thanks,
Scott
 
S

Scott_Brasted via AccessMonster.com

Hi,

Thanks for the primer on subforms. I also edit them directly as forms. I took
that code from a reply to an earlier post to see if it would help. I put your
code in and I still get a correct form for the first record and blanks for
the rest.

Scott
Hi Scott,

*** Difference between Subform Control and Subform ***

The first click on a subform control puts handles* around
the subform object.
*black squares in the corners and the middle of each size --
resizing handles

The subform object has properties such as

Name
SourceObject
LinkMasterFields
LinkChildFields
Visible
Locked
Left
Top
Width
Height

the subform control is just a container for the subform.

the subform itself is an independent form -- you can open it
directly from the database window and it has the same
properties of the main form. It is only called a subform
because of the way it is being used.

To summarize, when you are in the design view of the main
form, the first click on the subform is the subform control
-- you will see the handles around the edges -- and the
second click gets you INTO it -- you will see a black square
where the rulers intersect in the upper left of the "form"
you are "in" (and this is the same as if you went to the
design directly)

me.subform.controlname --> the subform control
me.subform.controlname.form --> the form inside the subform
control

Personally, I edit subforms directly, not from inside the
main form -- I have had trouble with Access putting property
changes in the wrong place for RowSources and RecordSource.
Since it happens there occassionally, for major changes, I
go to the design view of the "sub"form directly from the
databse window when the main form is closed.
the subform itself is an independent form -- you can open it
directly from the database window and it has the same
properties of the main form. It is only called a subform
because of the way it is being used.

To summarize, when you are in the design view of the main
form, the first click on the subform is the subform control
-- you will see the handles around the edges -- and the
second click gets you INTO it -- you will see a black square
where the rulers intersect in the upper left of the "form"
you are "in" (and this is the same as if you went to the
design directly)

me.subform.controlname --> the subform control
me.subform.controlname.form --> the form inside the subform
control

Personally, I edit subforms directly, not from inside the
main form -- I have had trouble with Access putting property
changes in the wrong place for RowSources and RecordSource.
Since it happens there occassionally, for major changes, I
go to the design view of the "sub"form directly from the
databse window when the main form is closed.

~~~

that said, it looks like you may need this:

Forms!frmCamPledgeList!frmCamPledgeListSub.form.idContributorID

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
Form: frmCamPledgeList
Subform: frmCamPledgeListSub
[quoted text clipped - 14 lines]
Thanks,
Scott
 
C

Crystal (strive4peace)

S

Scott_Brasted via AccessMonster.com

Hello again,

Yes, ContirbutorID field is on form as hidden field in the detail section.

The source for the main form is a table (tblDonationCampaignSetup). The
source for the subform is a query. Here is the SQL for the query:
SELECT tblContributors.*, tblPledges.PledgeID, tblPledges.Campaign_ID,
tblPledges.Contribution_CategoryID, tblPledges.PaymentTypeID, tblPledges.
DatePledged, tblPledges.AmountPledged, tblPledges.Paid, tblPledges.
PaymentDate
FROM tblContributors INNER JOIN tblPledges ON tblContributors.ContributorID =
tblPledges.ContributorID;

Thanks,
Scott

Hi Scott,

perhaps the problem is something else ... what is the
RecordSource for the form you are opening. If it is a
query, then post the SQL statement

Is the field you are using as a filter ON the form in a control?

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
[quoted text clipped - 4 lines]
 
J

John W. Vinson

Hello again,

Yes, ContirbutorID field is on form as hidden field in the detail section.

The source for the main form is a table (tblDonationCampaignSetup). The
source for the subform is a query. Here is the SQL for the query:
SELECT tblContributors.*, tblPledges.PledgeID, tblPledges.Campaign_ID,
tblPledges.Contribution_CategoryID, tblPledges.PaymentTypeID, tblPledges.
DatePledged, tblPledges.AmountPledged, tblPledges.Paid, tblPledges.
PaymentDate
FROM tblContributors INNER JOIN tblPledges ON tblContributors.ContributorID =
tblPledges.ContributorID;

This query will return no records for contributors who have no Pledges.

Ordinarily a Form or Subform would be based on a single-table query. I'm
guessing that tblContributors is related one to many to tblPledges; how would
your form handle the case where a contributor has many pledges, or no pledges
at all?
 
C

Crystal (strive4peace)

Hi Scott,

Perhaps the problem is that the RecordSource of your form
uses tables that are in a 1:many relationship -- it is best
to base each form and subform on only one table.

Does tblDonationCampaignSetup have ContributorID? Is that
what you are using for LinkMasterFields and LinkChildFields?

Is ContributorID on the subform as well?

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
 
S

Scott_Brasted via AccessMonster.com

Good morning Crystal,

Form recordsource = tblDonationCampaignSetup. It is is in a one 2 many
relationship with tblPledges and tblPledges is in a one 2 many with
tblContributors. tblPledges and tblContributors make up qryContirbutorPledges
which is the rcordsource for the subform.

tblDonationCampaignSetup linked to tblPledges through SetupID (primary key
one) to CampaignID (foreign key many). tblPledges linked to tblContributors
through PledgeID (primary key many) to ContributorID (foreign key one).

The answers are:
1 Yes
2 SourceObject: frmCamPledgeListSub
Link Child Field: Campaign_ID
Link Master Field: SetupID
3 Yes

Thanks,
Scott
Hi Scott,

Perhaps the problem is that the RecordSource of your form
uses tables that are in a 1:many relationship -- it is best
to base each form and subform on only one table.

Does tblDonationCampaignSetup have ContributorID? Is that
what you are using for LinkMasterFields and LinkChildFields?

Is ContributorID on the subform as well?

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
Hello again,
[quoted text clipped - 11 lines]
Thanks,
Scott
 
S

Scott_Brasted via AccessMonster.com

Hell John,

Your surmise is correct. The query returns names and pledges for contributors
to campaigns. No pledge, no name. All I want thecode to do is open a form
with donor details when I double click the donor name in the subform. See my
next answer to Crystal for detals on structure.

Best,
Sott
Hello again,
[quoted text clipped - 8 lines]
FROM tblContributors INNER JOIN tblPledges ON tblContributors.ContributorID =
tblPledges.ContributorID;

This query will return no records for contributors who have no Pledges.

Ordinarily a Form or Subform would be based on a single-table query. I'm
guessing that tblContributors is related one to many to tblPledges; how would
your form handle the case where a contributor has many pledges, or no pledges
at all?
 
C

Crystal (strive4peace)

Hi Scott,

I think John (Hi John!) hit the nail on the head when he
said that blank records are probably due to contributors
having no pledge info.

I recommend you redesign your forms to use just ONE table
for each form. This will alleviate a lot of problems

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*


Scott_Brasted via AccessMonster.com said:
Good morning Crystal,

Form recordsource = tblDonationCampaignSetup. It is is in a one 2 many
relationship with tblPledges and tblPledges is in a one 2 many with
tblContributors. tblPledges and tblContributors make up qryContirbutorPledges
which is the rcordsource for the subform.

tblDonationCampaignSetup linked to tblPledges through SetupID (primary key
one) to CampaignID (foreign key many). tblPledges linked to tblContributors
through PledgeID (primary key many) to ContributorID (foreign key one).

The answers are:
1 Yes
2 SourceObject: frmCamPledgeListSub
Link Child Field: Campaign_ID
Link Master Field: SetupID
3 Yes

Thanks,
Scott
Hi Scott,

Perhaps the problem is that the RecordSource of your form
uses tables that are in a 1:many relationship -- it is best
to base each form and subform on only one table.

Does tblDonationCampaignSetup have ContributorID? Is that
what you are using for LinkMasterFields and LinkChildFields?

Is ContributorID on the subform as well?

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
Hello again,
[quoted text clipped - 11 lines]
Thanks,
Scott
 
S

Scott_Brasted via AccessMonster.com

Hi Crystal,

I know that that makes sense, but the subform only has contributors in it.
Every record has a contribution. It would not be in the subform if it did not.
I am looking at the form right now and all the subform records for each
campaign have contributions so there are no enpty records. So can it be the
child/master link fields?

Best,
Scott
Hi Scott,

I think John (Hi John!) hit the nail on the head when he
said that blank records are probably due to contributors
having no pledge info.

I recommend you redesign your forms to use just ONE table
for each form. This will alleviate a lot of problems

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
Good morning Crystal,
[quoted text clipped - 49 lines]
 
S

Scott_Brasted via AccessMonster.com

Dear Crystal and John,

I don't want anyone to get mad or annoyed because I really appreciate all the
help I get here and I do not want anyone to think otherwise, but PLEASE read
my answers. I read yours. The query returns results. No blank records. All I
want is for the subform, where there are no blank records, to allow me to
double click on a field and open aonther form, period. If there is a reason
why a query result would disallow a vb double click event to occur, please
let me know.

I understand that it is difficult to diagnose long distance, and I appreciate
your patience, especially when the vehuicle does not allow for you to see any
of this. But I really did tell all this many times in my posts. If I am being
unclear, let me know and I will try to be better about my descriptions.

My very best regards to all on this site.
Scott


Scott_Brasted said:
Hi Crystal,

I know that that makes sense, but the subform only has contributors in it.
Every record has a contribution. It would not be in the subform if it did not.
I am looking at the form right now and all the subform records for each
campaign have contributions so there are no enpty records. So can it be the
child/master link fields?

Best,
Scott
Hi Scott,
[quoted text clipped - 26 lines]
 
C

Crystal (strive4peace)

hi Scott,

we just don't have enough information about your database to
know why this is happening... the best we can do is make
educated guesses based on what we have seen in the past to
cause problems.

I will take a look -- email me your database and specify
exactly what to pick and click to generate this problem in
your message -- and put your name in the subject line

strive4peace2009 at yahoo.com

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*


Scott_Brasted via AccessMonster.com said:
Dear Crystal and John,

I don't want anyone to get mad or annoyed because I really appreciate all the
help I get here and I do not want anyone to think otherwise, but PLEASE read
my answers. I read yours. The query returns results. No blank records. All I
want is for the subform, where there are no blank records, to allow me to
double click on a field and open aonther form, period. If there is a reason
why a query result would disallow a vb double click event to occur, please
let me know.

I understand that it is difficult to diagnose long distance, and I appreciate
your patience, especially when the vehuicle does not allow for you to see any
of this. But I really did tell all this many times in my posts. If I am being
unclear, let me know and I will try to be better about my descriptions.

My very best regards to all on this site.
Scott


Scott_Brasted said:
Hi Crystal,

I know that that makes sense, but the subform only has contributors in it.
Every record has a contribution. It would not be in the subform if it did not.
I am looking at the form right now and all the subform records for each
campaign have contributions so there are no enpty records. So can it be the
child/master link fields?

Best,
Scott
Hi Scott,
[quoted text clipped - 26 lines]
Thanks,
Scott
 
C

Crystal (strive4peace)

Hi Scott,

Got your database

First thing I did was look at your relationship diagram.
Unless you have a specific reason not to, you should enforce
Referential Integrity (RI) on all relationships

I find it very useful to lay out the diagram so it flows as
records must be created. For instance, before you can use
ContributorID in the Pledges table, the Contributor record
must be created -- so move it to the left of Pledges. Same
with your Categories ... and so on

In the table designs, remove the DefaultValue of 0 on your
numeric foreign keys (FK). For instance,
Pledges.Contribution_CategoryID has a default value of zero
which will not match to any record in ContributionCatagories
-- and even if it did, it would probably not be right. Read
about this in Access Basics (link in my siggy -- and you
should also pay close attention to the Combobox example)

frmCamPledgeList
RecordSource: tblDonationCampaignSetup

subform Name: frmCamPledgeListSub
subform RecordSource:
SELECT tblPledges.DatePledged, tblPledges.AmountPledged,
tblPledges.Paid, tblPledges.PaymentDate
, tblContributors.ContributorID,
tblContributors.DonorFirstName,
tblContributors.DonorLastName, ([DonorFirstName] & " " &
[DonorLastName]) AS Name, tblPledges.Campaign_ID
FROM tblContributors
INNER JOIN tblPledges
ON tblContributors.ContributorID = tblPledges.ContributorID;

do not use NAME as a name of any of your objects (fields,
tables, aliases, etc), it is a reserved word

Problem names and reserved words in Access, by Allen Browne
http://www.allenbrowne.com/AppIssueBadWord.html

Contributors is in a 1:many relationship with Pledges -- you
will have trouble adding records and changing contributor
information on this form. Best to base each form on just
one table.

Instead of pulling in the Contributors table to get the
name, base the RecordSource on Pledges and do this:

make ContributorID a combobox
RowSource:
SELECT ContributorID, (DonorFirstName + " ") & DonorLastName
AS Donor
FROM tblContributors
ORDER BY DonorFirstName, DonorLastName
ColumnCount --> 2
columnWidths --> 0;2
Listwidth --> 2.2 (sum of column widths + 0.2 for scrollbar)

here is the code you have to open the next form:

DoCmd.OpenForm "frmViewDonor", , ,
"tblContributors.[ContributorID] =" &
Forms!frmCamPledgeList!frmCamPledgeListSub.Form.idContributorID

firstly, you should have just one ContributorID in the
RecordSource (and you do) -- so you should not be
specifying the tablename

second, you are behind the form with the ContributorID so
you can use a relative reference instead of an absolute one

Forms!frmCamPledgeList!frmCamPledgeListSub.Form.idContributorID
--> Me.ContributorID

third, if you drop the combo in the ControlSource for
idContributorID on the Property sheet, you will find that
'tblContributors.ContributorID' doesn't match anything in
the list so it is not available as a value to use in the
code. Change the ControlSource to --> ContributorID
.... and actually, THIS IS THE REASON your form is not
opening with the right data <smile>

If you intend to let the user edit data in the second form,
you should not include information from PositionList in the
RecordSource -- you can show the Position in a combobox and
hide the ID as I suggested you do for Donor.

You should not use * to get fields from more than one table
in the RecordSource -- otherwise, the key fieldnames will be
duplicated (and that is not necessary). Instead, on the
occasion that you really do need to join fields from another
table in a RecordSource, use * on the main table the form is
based on and specifically choose fields from other tables.

POSITION, btw, is also a reserved word -- so change the
field name to something else like 'Posit' or 'Positn'


Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
 
S

Scott_Brasted via AccessMonster.com

Crystal,

Wow is the only word that comes to mind.

I have gone through this extensive reply carefully a couple of times and I
have also carefully folllowed your instructions and suggestions. All seems
well except that, irony here - this is the only part I do not understand:

And it,of course is the one thing I really need to understand. I assume you
are talking about the form frmCamPledgeList and it's combo box that supplies
the campaign record? After that I am lost. I tried changing the Control
Source to ContributorID, but that screws up the combo box and the vb for the
cbo gives me a run time error that says you cannot assign a value to this
object. So I think I do not know what you mean.

Sorry, you did yoeman's work and I am lacking.

Best,
Scott

Hi Scott,

Got your database

First thing I did was look at your relationship diagram.
Unless you have a specific reason not to, you should enforce
Referential Integrity (RI) on all relationships

I find it very useful to lay out the diagram so it flows as
records must be created. For instance, before you can use
ContributorID in the Pledges table, the Contributor record
must be created -- so move it to the left of Pledges. Same
with your Categories ... and so on

In the table designs, remove the DefaultValue of 0 on your
numeric foreign keys (FK). For instance,
Pledges.Contribution_CategoryID has a default value of zero
which will not match to any record in ContributionCatagories
-- and even if it did, it would probably not be right. Read
about this in Access Basics (link in my siggy -- and you
should also pay close attention to the Combobox example)

frmCamPledgeList
RecordSource: tblDonationCampaignSetup

subform Name: frmCamPledgeListSub
subform RecordSource:
SELECT tblPledges.DatePledged, tblPledges.AmountPledged,
tblPledges.Paid, tblPledges.PaymentDate
, tblContributors.ContributorID,
tblContributors.DonorFirstName,
tblContributors.DonorLastName, ([DonorFirstName] & " " &
[DonorLastName]) AS Name, tblPledges.Campaign_ID
FROM tblContributors
INNER JOIN tblPledges
ON tblContributors.ContributorID = tblPledges.ContributorID;

do not use NAME as a name of any of your objects (fields,
tables, aliases, etc), it is a reserved word

Problem names and reserved words in Access, by Allen Browne
http://www.allenbrowne.com/AppIssueBadWord.html

Contributors is in a 1:many relationship with Pledges -- you
will have trouble adding records and changing contributor
information on this form. Best to base each form on just
one table.

Instead of pulling in the Contributors table to get the
name, base the RecordSource on Pledges and do this:

make ContributorID a combobox
RowSource:
SELECT ContributorID, (DonorFirstName + " ") & DonorLastName
AS Donor
FROM tblContributors
ORDER BY DonorFirstName, DonorLastName
ColumnCount --> 2
columnWidths --> 0;2
Listwidth --> 2.2 (sum of column widths + 0.2 for scrollbar)

here is the code you have to open the next form:

DoCmd.OpenForm "frmViewDonor", , ,
"tblContributors.[ContributorID] =" &
Forms!frmCamPledgeList!frmCamPledgeListSub.Form.idContributorID

firstly, you should have just one ContributorID in the
RecordSource (and you do) -- so you should not be
specifying the tablename

second, you are behind the form with the ContributorID so
you can use a relative reference instead of an absolute one

Forms!frmCamPledgeList!frmCamPledgeListSub.Form.idContributorID
--> Me.ContributorID

third, if you drop the combo in the ControlSource for
idContributorID on the Property sheet, you will find that
'tblContributors.ContributorID' doesn't match anything in
the list so it is not available as a value to use in the
code. Change the ControlSource to --> ContributorID
... and actually, THIS IS THE REASON your form is not
opening with the right data <smile>

If you intend to let the user edit data in the second form,
you should not include information from PositionList in the
RecordSource -- you can show the Position in a combobox and
hide the ID as I suggested you do for Donor.

You should not use * to get fields from more than one table
in the RecordSource -- otherwise, the key fieldnames will be
duplicated (and that is not necessary). Instead, on the
occasion that you really do need to join fields from another
table in a RecordSource, use * on the main table the form is
based on and specifically choose fields from other tables.

POSITION, btw, is also a reserved word -- so change the
field name to something else like 'Posit' or 'Positn'

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
 
C

Crystal (strive4peace)

Hi Scott,

"Wow is the only word that comes to mind."

gee thanks! you're welcome :)

"And it,of course is the one thing I really need to
understand. "

I am referring to the Property sheet for the control. Read
the Properties and Methods section in Access Basics.

~~~
go to the design view of frmCamPledgeListSub

Select the idContributorID control ... but since it is under
[Name], you cannot see it

To select it you can drop down the combobox at the top of
the Property sheet and choose --> idContributorID
(I don't know why you did not name the control the same as
the Controlsource -- but at least it is specific)

Once you do get the control selected, move it to the header
section where you can SEE it in Design View and set the
following properties:
Visible --> No (Format tab of Property sheet)
ForeColor --> White (Font Color icon)
BackColor --> Black (Paint Bucket icon)

On the DATA tab, you will see a property called -->
ControlSource
click in it
when you do this, a drop-down arrow will appear to the right
-- this is the list of fields in your RecordSource. As you
can see, what you have it set to is not in the list...

these link controls are very important. It is one thing to
hide them from users when they view the form, but you need
to be able to see them right away when you look at the
design -- that is why I had you set it to be white on black.

"but that screws up the combo box and the vb for the cbo
gives me a run time error that says you cannot assign a
value to this object. "

if you still get an error, try to explain this better ...

"you did yoeman's work"

don't quite understand what you mean, but I will take it as
a compliment ;)



Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
 
S

Scott_Brasted via AccessMonster.com

Good morning Crystal,

Did you get this to work in your copy of the db? I followed your instructions
to the letter and I still get a blank form except for first record. Here is
what I did.
First changed all occurances of Name and Position to DonorName and Positn,
then:
1. moved idContributorID to subform header
2. renamed idContributorID control to ContributorID
3. changed background to black and text to white
4. selected ContributorID from Control Source dropdown list in property sheet
for text box control that is now in header of subform
5. saved subform
6 decided needed fresh start & deleted cbo & replaced w/Campaign Name field
temporarily in main form. will revisit soon.
7. saved main form.
8. double checked doubleclick event vb code on field "Donor_Name" for names,
etc. & changed idContributorID to ContributorID. Here is current code:
Private Sub Donor_Name_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmViewDonor", , , "ContributorID=" & Me.ContributorID
End Sub
9. saved code
10. restarted Access

No joy. Still blank records.
Scott

Hi Scott,

"Wow is the only word that comes to mind."

gee thanks! you're welcome :)

"And it,of course is the one thing I really need to
understand. "

I am referring to the Property sheet for the control. Read
the Properties and Methods section in Access Basics.

~~~
go to the design view of frmCamPledgeListSub

Select the idContributorID control ... but since it is under
[Name], you cannot see it

To select it you can drop down the combobox at the top of
the Property sheet and choose --> idContributorID
(I don't know why you did not name the control the same as
the Controlsource -- but at least it is specific)

Once you do get the control selected, move it to the header
section where you can SEE it in Design View and set the
following properties:
Visible --> No (Format tab of Property sheet)
ForeColor --> White (Font Color icon)
BackColor --> Black (Paint Bucket icon)

On the DATA tab, you will see a property called -->
ControlSource
click in it
when you do this, a drop-down arrow will appear to the right
-- this is the list of fields in your RecordSource. As you
can see, what you have it set to is not in the list...

these link controls are very important. It is one thing to
hide them from users when they view the form, but you need
to be able to see them right away when you look at the
design -- that is why I had you set it to be white on black.

"but that screws up the combo box and the vb for the cbo
gives me a run time error that says you cannot assign a
value to this object. "

if you still get an error, try to explain this better ...

"you did yoeman's work"

don't quite understand what you mean, but I will take it as
a compliment ;)

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
[quoted text clipped - 23 lines]
Best,
Scott
 
C

Crystal (strive4peace)

Hi Scott,

yes, it worked for me

send me the db, I will look again -- and make sure your
relationship diagram is laid out well as I will look at that
first <smile>

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*


Scott_Brasted via AccessMonster.com said:
Good morning Crystal,

Did you get this to work in your copy of the db? I followed your instructions
to the letter and I still get a blank form except for first record. Here is
what I did.
First changed all occurances of Name and Position to DonorName and Positn,
then:
1. moved idContributorID to subform header
2. renamed idContributorID control to ContributorID
3. changed background to black and text to white
4. selected ContributorID from Control Source dropdown list in property sheet
for text box control that is now in header of subform
5. saved subform
6 decided needed fresh start & deleted cbo & replaced w/Campaign Name field
temporarily in main form. will revisit soon.
7. saved main form.
8. double checked doubleclick event vb code on field "Donor_Name" for names,
etc. & changed idContributorID to ContributorID. Here is current code:
Private Sub Donor_Name_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmViewDonor", , , "ContributorID=" & Me.ContributorID
End Sub
9. saved code
10. restarted Access

No joy. Still blank records.
Scott

Hi Scott,

"Wow is the only word that comes to mind."

gee thanks! you're welcome :)

"And it,of course is the one thing I really need to
understand. "

I am referring to the Property sheet for the control. Read
the Properties and Methods section in Access Basics.

~~~
go to the design view of frmCamPledgeListSub

Select the idContributorID control ... but since it is under
[Name], you cannot see it

To select it you can drop down the combobox at the top of
the Property sheet and choose --> idContributorID
(I don't know why you did not name the control the same as
the Controlsource -- but at least it is specific)

Once you do get the control selected, move it to the header
section where you can SEE it in Design View and set the
following properties:
Visible --> No (Format tab of Property sheet)
ForeColor --> White (Font Color icon)
BackColor --> Black (Paint Bucket icon)

On the DATA tab, you will see a property called -->
ControlSource
click in it
when you do this, a drop-down arrow will appear to the right
-- this is the list of fields in your RecordSource. As you
can see, what you have it set to is not in the list...

these link controls are very important. It is one thing to
hide them from users when they view the form, but you need
to be able to see them right away when you look at the
design -- that is why I had you set it to be white on black.

"but that screws up the combo box and the vb for the cbo
gives me a run time error that says you cannot assign a
value to this object. "

if you still get an error, try to explain this better ...

"you did yoeman's work"

don't quite understand what you mean, but I will take it as
a compliment ;)

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
[quoted text clipped - 23 lines]
Best,
Scott
 
C

Crystal (strive4peace)

Hi Scott,

I see you got rid of the default values for numeric foreign
keys <smile>

In my opinion, it is best not to use Captions in the table
design -- the only people who should open tables directly
are administrators and they need to see the real fieldnames,
not captions

Do be sure to fill out the field Descriptions in your table
designs -- these are used for StatusBarText when you created
forms.

you still have forms based on multiple tables -- if you plan
to edit data, your should not do this

in frmViewDonor, do not pull Position information into the
RecordSource -- this can be shown using a combobox.

Because qryViewDonor gets all fields from both Contributors
and PositionList, you are only going to see records where
PositionID is filled out. Here is what you see for your
current sql:

SELECT tblContributors.*
, ([DonorFirstName] & " " & [DonorLastName]) AS DonorName
, ([City] & ", " & [StateorProvince] & " " & [PostalCode])
AS CSZ
, tblContributors.DonorLastName
, tblPositionList.*
FROM tblPositionList
INNER JOIN tblContributors
ON tblPositionList.Position_ID = tblContributors.PositionID
ORDER BY tblContributors.DonorLastName;

Donor First Name
Diane
Scott
Karen
Mary
Luci
Claire
June
Amy
Linda

by changing the Join Type to show all records from
Contributors even if a matching record is not found in
PositionList, the FROM clause of the sql now is:

FROM tblPositionList
RIGHT JOIN tblContributors
ON tblPositionList.Position_ID = tblContributors.PositionID

and we now see 20 records:

Donor First Name
Diane
Scott
Jackson
Karen
William
Mary
James
Joyce Ann
Mary Ellen
Gaston
Willy
Luci
Claire
June
Bill
Sara
James
Sam
Amy
Linda

.... but, as I said, you should not be pulling the
tblPositionList table into the RecordSource for this form anyway

It doesn't even look like you are using any fields from
PositionList on your form. The combobox for PositionID can
use PositionList as a RowSource withOUT it being in the form
RecordSource



Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*


Scott_Brasted via AccessMonster.com said:
Good morning Crystal,

Did you get this to work in your copy of the db? I followed your instructions
to the letter and I still get a blank form except for first record. Here is
what I did.
First changed all occurances of Name and Position to DonorName and Positn,
then:
1. moved idContributorID to subform header
2. renamed idContributorID control to ContributorID
3. changed background to black and text to white
4. selected ContributorID from Control Source dropdown list in property sheet
for text box control that is now in header of subform
5. saved subform
6 decided needed fresh start & deleted cbo & replaced w/Campaign Name field
temporarily in main form. will revisit soon.
7. saved main form.
8. double checked doubleclick event vb code on field "Donor_Name" for names,
etc. & changed idContributorID to ContributorID. Here is current code:
Private Sub Donor_Name_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmViewDonor", , , "ContributorID=" & Me.ContributorID
End Sub
9. saved code
10. restarted Access

No joy. Still blank records.
Scott

Hi Scott,

"Wow is the only word that comes to mind."

gee thanks! you're welcome :)

"And it,of course is the one thing I really need to
understand. "

I am referring to the Property sheet for the control. Read
the Properties and Methods section in Access Basics.

~~~
go to the design view of frmCamPledgeListSub

Select the idContributorID control ... but since it is under
[Name], you cannot see it

To select it you can drop down the combobox at the top of
the Property sheet and choose --> idContributorID
(I don't know why you did not name the control the same as
the Controlsource -- but at least it is specific)

Once you do get the control selected, move it to the header
section where you can SEE it in Design View and set the
following properties:
Visible --> No (Format tab of Property sheet)
ForeColor --> White (Font Color icon)
BackColor --> Black (Paint Bucket icon)

On the DATA tab, you will see a property called -->
ControlSource
click in it
when you do this, a drop-down arrow will appear to the right
-- this is the list of fields in your RecordSource. As you
can see, what you have it set to is not in the list...

these link controls are very important. It is one thing to
hide them from users when they view the form, but you need
to be able to see them right away when you look at the
design -- that is why I had you set it to be white on black.

"but that screws up the combo box and the vb for the cbo
gives me a run time error that says you cannot assign a
value to this object. "

if you still get an error, try to explain this better ...

"you did yoeman's work"

don't quite understand what you mean, but I will take it as
a compliment ;)

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
[quoted text clipped - 23 lines]
Best,
Scott
 
S

Scott_Brasted via AccessMonster.com

Evening Crystal,

One last thing hopefully. I took tblPostions out of the query and everything
works fine. I created a cbo for the position field and and it has the right
data in it, but the cbo is empty when I change records and stays empty. How
do I go about getting it to display the related data for the record. The data
list is there when I click the down arrow. Do I need code?

Best,
Scott
Hi Scott,

I see you got rid of the default values for numeric foreign
keys <smile>

In my opinion, it is best not to use Captions in the table
design -- the only people who should open tables directly
are administrators and they need to see the real fieldnames,
not captions

Do be sure to fill out the field Descriptions in your table
designs -- these are used for StatusBarText when you created
forms.

you still have forms based on multiple tables -- if you plan
to edit data, your should not do this

in frmViewDonor, do not pull Position information into the
RecordSource -- this can be shown using a combobox.

Because qryViewDonor gets all fields from both Contributors
and PositionList, you are only going to see records where
PositionID is filled out. Here is what you see for your
current sql:

SELECT tblContributors.*
, ([DonorFirstName] & " " & [DonorLastName]) AS DonorName
, ([City] & ", " & [StateorProvince] & " " & [PostalCode])
AS CSZ
, tblContributors.DonorLastName
, tblPositionList.*
FROM tblPositionList
INNER JOIN tblContributors
ON tblPositionList.Position_ID = tblContributors.PositionID
ORDER BY tblContributors.DonorLastName;

Donor First Name
Diane
Scott
Karen
Mary
Luci
Claire
June
Amy
Linda

by changing the Join Type to show all records from
Contributors even if a matching record is not found in
PositionList, the FROM clause of the sql now is:

FROM tblPositionList
RIGHT JOIN tblContributors
ON tblPositionList.Position_ID = tblContributors.PositionID

and we now see 20 records:

Donor First Name
Diane
Scott
Jackson
Karen
William
Mary
James
Joyce Ann
Mary Ellen
Gaston
Willy
Luci
Claire
June
Bill
Sara
James
Sam
Amy
Linda

... but, as I said, you should not be pulling the
tblPositionList table into the RecordSource for this form anyway

It doesn't even look like you are using any fields from
PositionList on your form. The combobox for PositionID can
use PositionList as a RowSource withOUT it being in the form
RecordSource

Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
Good morning Crystal,
[quoted text clipped - 97 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top