188e2 Where Condition in DoCmd function
Sign Up |  Live StatsLive Stats    Articles 37,330| Comments 177,252| Members 19,411, Newest Mongaloidicspasm| Online 452
Home Contact
 (Forgotten?): 
    Sikhism
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Click Here to Register/Sign Up Daily Hukamnama Member Blogs Downloads Website Navigation Help Fonts Tags

Where Condition in DoCmd function

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 115 USD (23%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
blanket condition over subreports Mark1 Information Technology 1 28-Jul-2006 08:35 AM
condition in some fields maha Information Technology 3 28-Jul-2006 08:32 AM
Error 2287 calling DoCmd.SendObject JohnA Information Technology 2 28-Jul-2006 08:29 AM
Open Query If Condition is Met Todd Information Technology 7 28-Jul-2006 08:21 AM
DoCmd Option Not Available At This Time ortaias@hotmail.com Information Technology 2 28-Jul-2006 08:14 AM


Tags
condition, docmd, function
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:16 AM
Marixxe's Avatar Marixxe
Guest
 
Posts: n/a
   
   
Where Condition in DoCmd function

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
Hello there!

In access visual basic, I would like to ask how would I enter a where
condition in a Docmd function, filtering a specific month and year.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/10869-where-condition-in-docmd-function.html

Example:

Docmd.Openform "formname", acNormal,,(WHERE CONDITION)

I would appreciate it very much if you could help me with my problem. Thank
you.

*







Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Jul-2006, 08:16 AM
Ken Snell \(MVP\)'s Avatar Ken Snell \(MVP\)
Guest
 
Posts: n/a
   
   
Re: Where Condition in DoCmd function

Generally, it would be something like this:

DoCmd.OpenForm "FormName", acNormal, , "NameOfField=SomeValue"
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10869

If you want to use a value from a control or variable, then this:

DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" & VariableName

Note that the syntax varies if the field type is numeric, date, or text:

Numeric:
DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" & VariableName

Text (delimit with ' character):
DoCmd.OpenForm "FormName", acNormal, , "NameOfField='" & VariableName & "'"

Date/Time (delimit with # character):
DoCmd.OpenForm "FormName", acNormal, , "NameOfField=#" &
Format(VariableName, "m\/d\/yyyy") & "#"
or
DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" & Format(VariableName,
"\#m\/d\/yyyy\#")
--

Ken Snell






"Marixxe" wrote in message
news:6DF9A6BA-6D15-41B1-82A3-1EACAA3AA2E8@microsoft.com...
> Hello there!
>
> In access visual basic, I would like to ask how would I enter a where
> condition in a Docmd function, filtering a specific month and year.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10869
>
> Example:
>
> Docmd.Openform "formname", acNormal,,(WHERE CONDITION)
>
> I would appreciate it very much if you could help me with my problem.
> Thank
> you.



Reply With Quote
  #3 (permalink)  
Old 28-Jul-2006, 08:16 AM
Marixxe's Avatar Marixxe
Guest
 
Posts: n/a
   
   
Re: Where Condition in DoCmd function

Thanks for the suggestion, but I think I'm mixed up. Anyway, I have here my
coding:

DoCmd.OpenForm "Income Statement Subform", acNormal, , DatePart("m",
Forms![Income Statement Subform]![Voucher_Date]) = 1

I have a crosstab query of Yearly Income Statement. Everytime I open the
query, it ask what year will it show and when I inputed a year, the result
shows the Account Description and its corresponding Amount for January,
February, March and so on. What I did was, I made a form for this query. What
I would like to happen to the form is that when I click in field name
JANUARY, I want the form "INCOME STATEMENT SUBFORM" to open and show only the
records for the month of JANUARY 2004. Please note that 2004 is the inputed
year in the query awhile ago.

I would appreciate it very much if you could help me with my problem. Thanks
so much.



"Ken Snell (MVP)" wrote:

> Generally, it would be something like this:
>
> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=SomeValue"
>
> If you want to use a value from a control or variable, then this:
>
> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" & VariableName
>
> Note that the syntax varies if the field type is numeric, date, or text:
>
> Numeric:
> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" & VariableName
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10869
>
> Text (delimit with ' character):
> DoCmd.OpenForm "FormName", acNormal, , "NameOfField='" & VariableName & "'"
>
> Date/Time (delimit with # character):
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10869
> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=#" &
> Format(VariableName, "m\/d\/yyyy") & "#"
> or
> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" & Format(VariableName,
> "\#m\/d\/yyyy\#")
> --
>
> Ken Snell
>
>
>
>
>
>
> "Marixxe" wrote in message
> news:6DF9A6BA-6D15-41B1-82A3-1EACAA3AA2E8@microsoft.com...
> > Hello there!
> >
> > In access visual basic, I would like to ask how would I enter a where
> > condition in a Docmd function, filtering a specific month and year.
> >
> > Example:
> >
> > Docmd.Openform "formname", acNormal,,(WHERE CONDITION)
> >
> > I would appreciate it very much if you could help me with my problem.
> > Thank
> > you.

>
>
>

Reply With Quote
  #4 (permalink)  
Old 28-Jul-2006, 08:16 AM
Ken Snell \(MVP\)'s Avatar Ken Snell \(MVP\)
Guest
 
Posts: n/a
   
   
Re: Where Condition in DoCmd function

First item is that you have not made a string of the Where condition. Look
at my example and see what is being done.

Second item is that you must use an expression that sets the value of one of
the fields in the second form's RecordSource. Your statement is just passing
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10869
a boolean result value to the form (the result of the comparison of the
DatePart function and the 1). Your expression does not include any field so
the form cannot filter anything.

For what you want to do, you must add a calculated field to the query that
is the second form's RecordSource query. That calculated field needs to
return the DatePart value on which you then will filter. So the calculated
field would be something like this (using generic field names):
TheMonth: DatePart("m", [NameOfDateFieldInTable])

Then the filter statement in the DoCmd.OpenForm would be this:
DoCmd.OpenForm "Income Statement Subform", acNormal, , "TheMonth =
1"

--

Ken Snell




"Marixxe" wrote in message
news:C1679421-E1FC-4A80-A6D4-37C31791B6EF@microsoft.com...
> Thanks for the suggestion, but I think I'm mixed up. Anyway, I have here
> my
> coding:
>
> DoCmd.OpenForm "Income Statement Subform", acNormal, , DatePart("m",
> Forms![Income Statement Subform]![Voucher_Date]) = 1
>
> I have a crosstab query of Yearly Income Statement. Everytime I open the
> query, it ask what year will it show and when I inputed a year, the result
> shows the Account Description and its corresponding Amount for January,
> February, March and so on. What I did was, I made a form for this query.
> What
> I would like to happen to the form is that when I click in field name
> JANUARY, I want the form "INCOME STATEMENT SUBFORM" to open and show only
> the
> records for the month of JANUARY 2004. Please note that 2004 is the
> inputed
> year in the query awhile ago.
>
> I would appreciate it very much if you could help me with my problem.
> Thanks
> so much.
>
>
>
> "Ken Snell (MVP)" wrote:
>
>> Generally, it would be something like this:
>>
>> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=SomeValue"
>>
>> If you want to use a value from a control or variable, then this:
>>
>> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" & VariableName
>>
>> Note that the syntax varies if the field type is numeric, date, or text:
>>
>> Numeric:
>> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" & VariableName
>>
>> Text (delimit with ' character):
>> DoCmd.OpenForm "FormName", acNormal, , "NameOfField='" & VariableName &
>> "'"
>>
>> Date/Time (delimit with # character):
>> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=#" &
>> Format(VariableName, "m\/d\/yyyy") & "#"
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10869
>> or
>> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" &
>> Format(VariableName,
>> "\#m\/d\/yyyy\#")
>> --
>>
>> Ken Snell
>>
>>
>>
>>
>>
>>
>> "Marixxe" wrote in message
>> news:6DF9A6BA-6D15-41B1-82A3-1EACAA3AA2E8@microsoft.com...
>> > Hello there!
>> >
>> > In access visual basic, I would like to ask how would I enter a where
>> > condition in a Docmd function, filtering a specific month and year.
>> >
>> > Example:
>> >
>> > Docmd.Openform "formname", acNormal,,(WHERE CONDITION)
>> >
>> > I would appreciate it very much if you could help me with my problem.
>> > Thank
>> > you.

>>
>>
>>



Reply With Quote
  #5 (permalink)  
Old 28-Jul-2006, 08:17 AM
Marixxe's Avatar Marixxe
Guest
 
Posts: n/a
   
   
Re: Where Condition in DoCmd function

  Donate Today!  

Thank you very much for your help, Ken. Now I can proceed to my other
concerns.


"Ken Snell (MVP)" wrote:

> First item is that you have not made a string of the Where condition. Look
> at my example and see what is being done.
>
> Second item is that you must use an expression that sets the value of one of
> the fields in the second form's RecordSource. Your statement is just passing
> a boolean result value to the form (the result of the comparison of the
> DatePart function and the 1). Your expression does not include any field so
> the form cannot filter anything.
>
> For what you want to do, you must add a calculated field to the query that
> is the second form's RecordSource query. That calculated field needs to
> return the DatePart value on which you then will filter. So the calculated
> field would be something like this (using generic field names):
> TheMonth: DatePart("m", [NameOfDateFieldInTable])
>
> Then the filter statement in the DoCmd.OpenForm would be this:
> DoCmd.OpenForm "Income Statement Subform", acNormal, , "TheMonth =
> 1"
>
> --
>
> Ken Snell
>
>
>
>
> "Marixxe" wrote in message
> news:C1679421-E1FC-4A80-A6D4-37C31791B6EF@microsoft.com...
> > Thanks for the suggestion, but I think I'm mixed up. Anyway, I have here
> > my
> > coding:
> >
> > DoCmd.OpenForm "Income Statement Subform", acNormal, , DatePart("m",
> > Forms![Income Statement Subform]![Voucher_Date]) = 1
> >
> > I have a crosstab query of Yearly Income Statement. Everytime I open the
> > query, it ask what year will it show and when I inputed a year, the result
> > shows the Account Description and its corresponding Amount for January,
> > February, March and so on. What I did was, I made a form for this query.
> > What
> > I would like to happen to the form is that when I click in field name
> > JANUARY, I want the form "INCOME STATEMENT SUBFORM" to open and show only
> > the
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10869
> > records for the month of JANUARY 2004. Please note that 2004 is the
> > inputed
> > year in the query awhile ago.
> >
> > I would appreciate it very much if you could help me with my problem.
> > Thanks
> > so much.
> >
> >
> >
> > "Ken Snell (MVP)" wrote:
> >
> >> Generally, it would be something like this:
> >>
> >> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=SomeValue"
> >>
> >> If you want to use a value from a control or variable, then this:
> >>
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10869
> >> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" & VariableName
> >>
> >> Note that the syntax varies if the field type is numeric, date, or text:
> >>
> >> Numeric:
> >> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" & VariableName
> >>
> >> Text (delimit with ' character):
> >> DoCmd.OpenForm "FormName", acNormal, , "NameOfField='" & VariableName &
> >> "'"
> >>
> >> Date/Time (delimit with # character):
> >> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=#" &
> >> Format(VariableName, "m\/d\/yyyy") & "#"
> >> or
> >> DoCmd.OpenForm "FormName", acNormal, , "NameOfField=" &
> >> Format(VariableName,
> >> "\#m\/d\/yyyy\#")
> >> --
> >>
> >> Ken Snell
> >>
> >>
> >>
> >>
> >>
> >>
> >> "Marixxe" wrote in message
> >> news:6DF9A6BA-6D15-41B1-82A3-1EACAA3AA2E8@microsoft.com...
> >> > Hello there!
> >> >
> >> > In access visual basic, I would like to ask how would I enter a where
> >> > condition in a Docmd function, filtering a specific month and year.
> >> >
> >> > Example:
> >> >
> >> > Docmd.Openform "formname", acNormal,,(WHERE CONDITION)
> >> >
> >> > I would appreciate it very much if you could help me with my problem.
> >> > Thank
> >> > you.
> >>
> >>
> >>

>
>
>

Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
Do you believe in...
Today 08:18 AM
193 Replies, 4,018 Views
Black Sikhs?
Today 06:33 AM
20 Replies, 5,747 Views
Man Driving Without...
Today 05:06 AM
5 Replies, 110 Views
Request for assistance...
Today 04:24 AM
8 Replies, 70 Views
Losing My Religion: Why...
Today 03:03 AM
13 Replies, 313 Views
Health Exercise And...
Today 02:10 AM
1 Replies, 71 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Today 02:10 AM
176 Replies, 4,499 Views
How Religions Change...
Today 02:07 AM
1 Replies, 97 Views
Keeping Amrit Vela
Today 01:57 AM
11 Replies, 889 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 01:52 AM
313 Replies, 7,574 Views
How does Sikhi help you...
Yesterday 22:54 PM
22 Replies, 889 Views
Panjabi
By Ishna
Yesterday 17:56 PM
12 Replies, 264 Views
Parkash Guru Amar Das ji...
Yesterday 17:07 PM
3 Replies, 50 Views
Serious challenges to...
Yesterday 16:49 PM
0 Replies, 113 Views
Sikh man fights for his...
Yesterday 16:46 PM
0 Replies, 79 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 08:42 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.83154 seconds with 32 queries
0