Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-13-2018, 11:36 AM   #1
andy1968
Newly Registered User
 
Join Date: May 2018
Posts: 40
Thanks: 27
Thanked 1 Time in 1 Post
andy1968 is on a distinguished road
Troulbe with Where Clause

I'm trying to open one from from another with a where clause to take me to the same record.


From frmToDoListAll, in the Subform, I have the code:

Private Sub What_DblClick(Cancel As Integer)


DoCmd.OpenForm "frmToDoListEntry", , , "[ID]=" & Me.[ID] & ""


End Sub


frmToDoListEntry shows all the records.


I've attached the database.
Attached Files
File Type: zip fromFilter.zip (75.7 KB, 8 views)

andy1968 is offline   Reply With Quote
Old 08-13-2018, 12:05 PM   #2
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 6,918
Thanks: 92
Thanked 1,701 Times in 1,579 Posts
isladogs is just really nice isladogs is just really nice isladogs is just really nice isladogs is just really nice isladogs is just really nice
Re: Troulbe with Where Clause

You need to force a save before opening the form
Add this before the open form line

If Me.Dirty Then Me.Dirty = False
__________________
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
Previously known as ridders : 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 08-13-2018, 12:13 PM   #3
andy1968
Newly Registered User
 
Join Date: May 2018
Posts: 40
Thanks: 27
Thanked 1 Time in 1 Post
andy1968 is on a distinguished road
Re: Troulbe with Where Clause

OK.


Changed the code to:


If Me.Dirty Then Me.Dirty = False

DoCmd.OpenForm "frmToDoListEntry", , , "[ID]=" & Me.[ID] & ""


Still get all the records.

andy1968 is offline   Reply With Quote
Old 08-13-2018, 12:29 PM   #4
June7
Newly Registered User
 
Join Date: Mar 2014
Posts: 806
Thanks: 0
Thanked 182 Times in 182 Posts
June7 will become famous soon enough
Re: Troulbe with Where Clause

frmToDoListEntry has DataEntry set to Yes. It should only open to NewRecord row. Why it is opening to any records at all is a mystery.

frmToDoListEntry opens to all records when frmToDoRecall is open. When it is not, then frmToDoListEntry opens to only New Record row. More mystery. Must be code behind frmToDoListEntry controlling this. Will look at later.


Won't make a difference, but the & "" is not necessary.
__________________
To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.

Last edited by June7; 08-13-2018 at 12:44 PM.
June7 is offline   Reply With Quote
Old 08-13-2018, 12:45 PM   #5
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 6,918
Thanks: 92
Thanked 1,701 Times in 1,579 Posts
isladogs is just really nice isladogs is just really nice isladogs is just really nice isladogs is just really nice isladogs is just really nice
Re: Troulbe with Where Clause

The me.dirty line means you get the correct person!
I also removed the &"" as june mentioned.

It seems to be working but maybe I'm missing something. See attached
Attached Files
File Type: zip fromFilter.zip (85.9 KB, 7 views)
__________________
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
Previously known as ridders : 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 08-13-2018, 02:22 PM   #6
andy1968
Newly Registered User
 
Join Date: May 2018
Posts: 40
Thanks: 27
Thanked 1 Time in 1 Post
andy1968 is on a distinguished road
Re: Troulbe with Where Clause

June,


Yes, there is code behind the form to change it from dataentry true to false.


Ridders,


Downloaded your version.


It still opens to all the records.
andy1968 is offline   Reply With Quote
Old 08-14-2018, 12:12 AM   #7
June7
Newly Registered User
 
Join Date: Mar 2014
Posts: 806
Thanks: 0
Thanked 182 Times in 182 Posts
June7 will become famous soon enough
Re: Troulbe with Where Clause

Suggest you set the DataEntry property to No. Then code:

Private Sub Form_Load()
If Not CurrentProject.AllForms("frmToDoRecall").IsLoaded Then
Me.DataEntry = True
End If
End Sub

__________________
To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.
June7 is offline   Reply With Quote
The Following User Says Thank You to June7 For This Useful Post:
andy1968 (08-14-2018)
Old 08-14-2018, 12:25 AM   #8
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 6,918
Thanks: 92
Thanked 1,701 Times in 1,579 Posts
isladogs is just really nice isladogs is just really nice isladogs is just really nice isladogs is just really nice isladogs is just really nice
Re: Troulbe with Where Clause

Quote:
Originally Posted by andy1968 View Post
Ridders,
Downloaded your version.
It still opens to all the records.
Then I am missing something. Which form shows all the record?
The first one or the one opened by clicking the 'What' control?
Sorry can't remember form names as its not on this computer
__________________
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
Previously known as ridders : 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
The Following User Says Thank You to isladogs For This Useful Post:
andy1968 (08-14-2018)
Old 08-14-2018, 05:33 AM   #9
andy1968
Newly Registered User
 
Join Date: May 2018
Posts: 40
Thanks: 27
Thanked 1 Time in 1 Post
andy1968 is on a distinguished road
Re: Troulbe with Where Clause

From the subform "frmToDoListAll" I want to double click on the "What" field to open the form "frmToDoListEntry" and display the record that I click on.


I've attached some screen shots.


The onload for "frmToDoListEntry" set it's data entry to false
Attached Files
File Type: zip filter.zip (84.6 KB, 14 views)
andy1968 is offline   Reply With Quote
Old 08-14-2018, 10:19 AM   #10
June7
Newly Registered User
 
Join Date: Mar 2014
Posts: 806
Thanks: 0
Thanked 182 Times in 182 Posts
June7 will become famous soon enough
Re: Troulbe with Where Clause

Did you try suggestion in post 7?
__________________
To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.
June7 is offline   Reply With Quote
The Following User Says Thank You to June7 For This Useful Post:
andy1968 (08-14-2018)
Old 08-14-2018, 11:36 AM   #11
mike60smart
Newly Registered User
 
mike60smart's Avatar
 
Join Date: Aug 2017
Location: Dunbar, Scotland
Posts: 210
Thanks: 21
Thanked 43 Times in 43 Posts
mike60smart is on a distinguished road
Re: Troulbe with Where Clause

Hi Andy?

I recreated the frmToDoListEntry and named it frmToDoListEntry2

See if the attached does what you need?

fromFilter.zip
mike60smart is offline   Reply With Quote
The Following User Says Thank You to mike60smart For This Useful Post:
andy1968 (08-14-2018)
Old 08-14-2018, 11:56 AM   #12
andy1968
Newly Registered User
 
Join Date: May 2018
Posts: 40
Thanks: 27
Thanked 1 Time in 1 Post
andy1968 is on a distinguished road
Re: Troulbe with Where Clause

June7 - your solution works. Thanks! First time I looked at it I missed the Not in the If statement.


Mike, your's work too. I don't want to use 2 separate forms though. One form is easier to manage.

andy1968 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
not like in where clause mikeo1313 Queries 2 10-19-2010 12:13 AM
SQL where clause within a SUM clause in the SELECT statement chris-uk-lad General 3 07-21-2008 05:01 AM
SQL where clause within a SUM clause in the SELECT statement chris-uk-lad General 1 07-21-2008 03:37 AM
where clause nils Queries 2 05-30-2006 05:03 PM
Where clause Lyncroft Forms 2 08-16-2003 09:39 AM




All times are GMT -8. The time now is 04:01 AM.


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

Sponsored Links

How to advertise

Media Kit


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