Search EggHeadCafe's Job Board
EggHeadCafe Silverlight WPF ASP.NET VB.NET C# Excel SQL Server SharePoint
search
MicrosoftArticlesForumsFAQs
C# .NET
VB.NET
Visual Studio .NET
ADO.NET
Xml / Xslt
VB 6.0
.NET CF
GDI+
LINQ
Deployment
Security
FoxPro
Silverlight / WPF
Entity Framework
RIA Services

WebArticlesForumsFAQs
JavaScript
ASP
ASP.NET
WCF

DatabasesArticlesForumsFAQs
SQL Server
Access
Oracle
MySQL
Other Databases

OfficeArticlesForumsFAQs
Excel
Word
Powerpoint
Outlook
Publisher
Money

Non-MicrosoftArticlesForumsFAQs
NHibernate
Perl
PHP
Ruby
Java
Linux / Unix
Apple
Open Source

Operating SysArticlesForumsFAQs
Windows 7
Windows Server
Windows Vista
Windows XP
Windows Update
MAC
Linux / UNIX

Server PlatformsArticlesForumsFAQs
BizTalk
Site Server
Exhange Server
IIS

Graphic DesignArticlesForumsFAQs
Macromedia Flash
Adobe PhotoShop
Expression Blend
Expression Design
Expression Web

OtherArticlesForumsFAQs
Lounge
Subversion / CVS
Ask Dr. Dotnetsky
Active Directory
Networking
Uninstall Virus
Job Openings
Product Reviews
Search Engines
Resumes

 

  View Other Microsoft Access Posts   Ask New Question  Ask New Question With Power Editor

Using Query Results as Conditions in VBA If / Then Statement
Eric Brown posted at Monday, November 02, 2009 3:12 PM

I am using MS Access 2002 as a quarterly data capture tool. I have built a definitional form (frmDefinition) that captures the parameters of the data points I am collecting (all manual). Within that form I have embedded a subform (sfrmStatus) into which I input the data associated with the individual definition each quarter. The selection of the reporting period is manual from a dropdown box that is populated from a table (tblPeriod) - I have consciously chosen not to code the date / timeframe into the tool.

Here's my challenge: I am trying to code the subform such that only the current quarter is can be editted at any point and the rest of the data is locked. I have created a form (frmPeriod) that contains a check box for each quarter (continuous form linked to the tblPeriod table). The check box may be selected to indicate the current quarter (chkCurrentQ). I have coded that form to only allow one quarter to be checked at any given time.

My theory was that I could run a query against tblPeriod filtering for the single item that was marked as the current quarter and that I could use that query result as the conditional criteria in an If / Then statement in the sfrmStatus subform to lock the records that were not during that quarter. I have not figured out how to reference that data though as a condition. Any help would be very appreciated, including any alternative approaches to this challenge. Thanks in advance.

Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0
re
firoz poil provided a rated reply to Eric Brown on Thursday, November 05, 2009 8:19 AM

analyse the following I abstracted from my project change the field and other

SELECT ODC.[order no], ODC.[received date], ODC.[delivered date], ODC.name, ODC.deliveryordno
FROM ODC
WHERE (((ODC.[delivered date]) Between [Forms]![DAT]![Text0] And [Forms]![DAT]![Text1]) AND ((ODC.name)=IIf([Forms]![dat]![Frame88]=2,[Forms]![dat]![namee],[name])));

Add more If condition as per your requirement.

Reply    Reply Using Power Editor
  Rank Winnings Points
November 25 $0.00 10
October 0 $0.00 0