|
-
Feb 22nd, 2006, 12:04 PM
#1
Thread Starter
Frenzied Member
Access query parameters prompting twice
In the following query, the two parameter prompts ("Type the beginning date:", etc), pop up twice. It returns the correct results, but why come up twice? I don't think the last prompt should come up either, since it's the same as the previous one, but at least I'd understand that. I've tried changing parantheses, etc, same thing. Thanks.
I hate working on other people's old rickety code
Code:
SELECT DISTINCTROW [Full Data].[Record Number], [Full Data].Date, ...
FROM [Full Data]
WHERE fldReported = False
AND (([Full Data].Date Between [Type the beginning date:] And [Type the ending date:])
OR (fldCompleted = TRUE AND fldTermDate <= [Type the ending date:]));
Tengo mas preguntas que contestas
-
Feb 22nd, 2006, 02:38 PM
#2
Re: Access query parameters prompting twice
Both come up twice? or just Ending date? I could see ending date prompting twice since u are using it twice...
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Feb 22nd, 2006, 02:49 PM
#3
Re: Access query parameters prompting twice
ok try this:
Code:
SELECT DISTINCTROW [Full Data].[Record Number], [Full Data].Date, ...
FROM [Full Data], (SELECT [Type the beginning date:] as BD, [Type the ending date:] as ED FROM [Full Data]) as FD2
WHERE fldReported = False
AND (([Full Data].Date Between FD2.BD And FD2.ED)
OR (fldCompleted = TRUE AND fldTermDate <= FD2.ED));
if u create the prompts in a SELECT qry as part of the FROM u can then refer to them in the WHERE clause with the alias'
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Feb 22nd, 2006, 02:50 PM
#4
Re: Access query parameters prompting twice
You can create parameters instead so you can reference them thoughout your query.
VB Code:
PARAMETERS Start_Date DateTime, End_Date DateTime;
SELECT DISTINCTROW [Full Data].[Record Number], [Full Data].Date, ...
FROM [Full Data]...
FROM [Full Data]
WHERE fldReported = False
AND (([Full Data].Date Between [Start_Date] And [End_Date])
OR (fldCompleted = TRUE AND fldTermDate <= [End_Date]));
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 22nd, 2006, 02:59 PM
#5
Re: Access query parameters prompting twice
O M G!!! That is awesome Dog!! all the times I have had issues with parameters i NEVER new you could do something SOOO easy!!
that almost makes me mad!! lol!!
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Feb 22nd, 2006, 03:01 PM
#6
Re: Access query parameters prompting twice
Thanks. 
Easy way to generate them is to go into Access and create a new query. Then right click in the grey area where it usually displays the choosen table(s) and select Parameters from the contexxt menu. Type in a name for your parameter and choose a data type. click the ok button and then view the sql code generated. Its kind of like recording a maco I guess.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 22nd, 2006, 03:07 PM
#7
Re: Access query parameters prompting twice
I have always stuck them in the Criteria Section..... I have some buddies that will be interested in this
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Feb 22nd, 2006, 03:11 PM
#8
Re: Access query parameters prompting twice
Cool, maybe I should add this to my FAQ I have been making for the past few months in between posting. Its going to be a general FAQ for all Office apps and its massive.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 22nd, 2006, 03:25 PM
#9
Re: Access query parameters prompting twice
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Feb 22nd, 2006, 03:28 PM
#10
Re: Access query parameters prompting twice
I just need to pull myself away from posting and helping so I can finish it for about a week or so but too adicted lol.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 22nd, 2006, 03:33 PM
#11
Re: Access query parameters prompting twice
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|