Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 02-10-2019, 03:51 AM   #16
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 10,099
Thanks: 110
Thanked 2,744 Times in 2,503 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Reference parent form in DLookup Criteria

Quote:
Originally Posted by DataBass View Post
Now, it works as expected because it isn't trying to look to the parent form. However, it really seems like there ought to be a way to make it work by pointing it to the parent form.

Do you guys agree?
Yes I agree and I've done it myself in the past - if you are willing to upload it, I will have a look
Having said that, I've used the same work-round as you on more than one occasion

Did you ever confirm that the name of the top subform CONTAINER is frmSub1?
i.e. the name of the subform control in the main form - it may NOT the name as the subform itself

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by isladogs; 02-10-2019 at 04:11 AM.
isladogs is offline   Reply With Quote
Old 02-10-2019, 06:23 AM   #17
MajP
Newly Registered User
 
Join Date: May 2018
Location: USA baby
Posts: 1,760
Thanks: 28
Thanked 527 Times in 500 Posts
MajP will become famous soon enough MajP will become famous soon enough
Re: Reference parent form in DLookup Criteria

I tested this with a subdatasheet like in the picture and it works fine with the
parent.ControlName notation.
However, there is a much bigger issue in doing this, so I would not pursue doing that. If you expand the subdatasheet and you are not on that record you will pull the reference for the record that you are on. The only way to get the correct reference is to minimize the subdatasheet and then move to it and then open it.
MajP is offline   Reply With Quote
Old 02-11-2019, 02:30 AM   #18
DataBass
Newly Registered User
 
Join Date: Jun 2018
Location: Downtown
Posts: 68
Thanks: 27
Thanked 0 Times in 0 Posts
DataBass is on a distinguished road
Re: Reference parent form in DLookup Criteria

Quote:
Originally Posted by MajP View Post
I tested this with a subdatasheet like in the picture and it works fine with the
parent.ControlName notation.
However, there is a much bigger issue in doing this, so I would not pursue doing that. If you expand the subdatasheet and you are not on that record you will pull the reference for the record that you are on. The only way to get the correct reference is to minimize the subdatasheet and then move to it and then open it.
Did you actually use the word "parent" in the criteria? If so, did you put the DLookup in the control source?

I could never get it to give me a result beyond the 1st record. If it behaves as you say, that definitely is a problem.

Quote:
Originally Posted by isladogs View Post
Yes I agree and I've done it myself in the past - if you are willing to upload it, I will have a look
Having said that, I've used the same work-round as you on more than one occasion

Did you ever confirm that the name of the top subform CONTAINER is frmSub1?
i.e. the name of the subform control in the main form - it may NOT the name as the subform itself
Yes, the container and the subform have the same name. Good idea, but I don't think that's the issue.

This database is a monstrosity. I would have to scale it down to an upload-friendly format. If I can do that, I'd love to have you take a look and see if Dlookup can work as intended.

I'll admit it's re-assuring to know that you've used this same workaround. For now it seems like an OK solution.

DataBass is offline   Reply With Quote
Old 02-11-2019, 07:32 AM   #19
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 10,099
Thanks: 110
Thanked 2,744 Times in 2,503 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Reference parent form in DLookup Criteria

Up to you. The offer still stands if you want to take it up.

Looking again at your two screenshots, is there any good reason why you haven't just modified the record source for subform2 to include the Unit field from tblData using joins to include the Category and Stage fields.

If you do that, the field will populate automatically and there will be no need to use DLookup at all....
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 02-11-2019, 11:47 AM   #20
DataBass
Newly Registered User
 
Join Date: Jun 2018
Location: Downtown
Posts: 68
Thanks: 27
Thanked 0 Times in 0 Posts
DataBass is on a distinguished road
Re: Reference parent form in DLookup Criteria

That is a good idea. If I recall correctly, I think I tried that over the weekend. It did pull in the correct values for the Unit field, but having those joins made the recordsource not updateable and I couldn't create new records.

I'll try it again this afternoon to doublecheck.
DataBass is offline   Reply With Quote
Old 02-11-2019, 12:15 PM   #21
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 10,099
Thanks: 110
Thanked 2,744 Times in 2,503 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Reference parent form in DLookup Criteria

If it is read only, read this link for reasons http://allenbrowne.com/ser-61.html
There are usually work rounds available

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Form Filter - How to reference a DLookUp field blub Forms 1 03-09-2014 03:28 AM
DLOOKUP Needs to Reference Form or Subform samjh Forms 1 05-16-2013 01:56 AM
Reference unbound control through tabbed parent form skwilliams Forms 3 03-08-2011 06:35 AM
Goto record in Parent form by searching criteria in Subform csharrock69 Forms 8 12-22-2010 08:55 AM
reference a field on parent form from the child form madrav72 Forms 1 12-04-2005 01:01 PM




All times are GMT -8. The time now is 07:54 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World