PC Review


Reply
Thread Tools Rate Thread

Passing FORM value to my Query inside VBA

 
 
vikash.verma
Guest
Posts: n/a
 
      31st Mar 2004
Hi All
I have written an application where in i need to call a FORM,MACRO and then
a VBA.
Inside a Macro an Action RunCode is written which in turn calls a VBA code
written below

intValue = DLookup("NumCount", "Query1Test")

This query has a Where condition

Query1Test:
SELECT Count(*) AS NumCount FROM DelMastTemp
WHERE (((DelMastTemp.CustomerID)=Forms!Forms_DAR!Driver_Control.Value) AND
(DelMastTemp.StartDate=Forms!Forms_DAR!StartDate_Control.Value));

But this Where condition value is being passed frm my FORM to this Query.
If i run the Query alone i get a Parameter Value in that i pass the data nd
i get the Resul.

But when i run through this Form it throws an exception.I know the reason
behind it .The VALUE in the query is not being passed from the FORM.How nd
where should i give my WHERE Condition so that my query works.

Shall i have to give the where condition inside the DLookup() or HOW?

I am hoping to receive mails frm u all.

Regards
Vikash



 
Reply With Quote
 
 
 
 
Art
Guest
Posts: n/a
 
      31st Mar 2004
Hi Vikash,
In the criteria row of the query in the field whose
value you need from the form.. put
Forms!YourForm!FormsField
If the field name has a space in it, you will need to
enclose it in brackets.

Hope This Helps
>-----Original Message-----
>Hi All
>I have written an application where in i need to call a

FORM,MACRO and then
>a VBA.
>Inside a Macro an Action RunCode is written which in

turn calls a VBA code
>written below
>
>intValue = DLookup("NumCount", "Query1Test")
>
>This query has a Where condition
>
>Query1Test:
>SELECT Count(*) AS NumCount FROM DelMastTemp
>WHERE (((DelMastTemp.CustomerID)=Forms!Forms_DAR!

Driver_Control.Value) AND
>(DelMastTemp.StartDate=Forms!Forms_DAR!

StartDate_Control.Value));
>
>But this Where condition value is being passed frm my

FORM to this Query.
>If i run the Query alone i get a Parameter Value in that

i pass the data nd
>i get the Resul.
>
>But when i run through this Form it throws an exception.I

know the reason
>behind it .The VALUE in the query is not being passed

from the FORM.How nd
>where should i give my WHERE Condition so that my query

works.
>
>Shall i have to give the where condition inside the

DLookup() or HOW?
>
>I am hoping to receive mails frm u all.
>
>Regards
>Vikash
>
>
>
>.
>

 
Reply With Quote
 
 
 
 
vikash.verma
Guest
Posts: n/a
 
      1st Apr 2004
Hi Art,
Infact i am calling the query inside the DLookUp() fn.The Where condition has to be specified.


intCustCount = DLookup("NumCount", "Query1Test", " [StartDate]=#8/22/2003#")

But it gives me an Error even by using
1. Static Data (It says U cancelled the Prevoius operation,Run time Error 2001)
2. By using [StartDate]= Forms!Form_DAR!StartDate.Value(The Error says cant find Form_DAR)

I need to get the count of the from my DLookUp() fn if there are no reocrds for that specific date i generate a MsgBox.

I am waiting for ur mail




"Art" <(E-Mail Removed)> wrote in message news:138ab01c41739$7033bc70$(E-Mail Removed)...
> Hi Vikash,
> In the criteria row of the query in the field whose
> value you need from the form.. put
> Forms!YourForm!FormsField
> If the field name has a space in it, you will need to
> enclose it in brackets.
>
> Hope This Helps
> >-----Original Message-----
> >Hi All
> >I have written an application where in i need to call a

> FORM,MACRO and then
> >a VBA.
> >Inside a Macro an Action RunCode is written which in

> turn calls a VBA code
> >written below
> >
> >intValue = DLookup("NumCount", "Query1Test")
> >
> >This query has a Where condition
> >
> >Query1Test:
> >SELECT Count(*) AS NumCount FROM DelMastTemp
> >WHERE (((DelMastTemp.CustomerID)=Forms!Forms_DAR!

> Driver_Control.Value) AND
> >(DelMastTemp.StartDate=Forms!Forms_DAR!

> StartDate_Control.Value));
> >
> >But this Where condition value is being passed frm my

> FORM to this Query.
> >If i run the Query alone i get a Parameter Value in that

> i pass the data nd
> >i get the Resul.
> >
> >But when i run through this Form it throws an exception.I

> know the reason
> >behind it .The VALUE in the query is not being passed

> from the FORM.How nd
> >where should i give my WHERE Condition so that my query

> works.
> >
> >Shall i have to give the where condition inside the

> DLookup() or HOW?
> >
> >I am hoping to receive mails frm u all.
> >
> >Regards
> >Vikash
> >
> >
> >
> >.
> >

 
Reply With Quote
 
vikash.verma
Guest
Posts: n/a
 
      1st Apr 2004
Hi Art,
Infact i am calling the query inside the DLookUp() fn.The Where condition has to be specified.


intCustCount = DLookup("NumCount", "Query1Test", " [StartDate]=#8/22/2003#")

But it gives me an Error even by using
1. Static Data (It says U cancelled the Prevoius operation,Run time Error 2001)
2. By using [StartDate]= Forms!Form_DAR!StartDate.Value(The Error says cant find Form_DAR)

I need to get the count of the from my DLookUp() fn if there are no reocrds for that specific date i generate a MsgBox.

I am waiting for ur mail




"Art" <(E-Mail Removed)> wrote in message news:138ab01c41739$7033bc70$(E-Mail Removed)...
> Hi Vikash,
> In the criteria row of the query in the field whose
> value you need from the form.. put
> Forms!YourForm!FormsField
> If the field name has a space in it, you will need to
> enclose it in brackets.
>
> Hope This Helps
> >-----Original Message-----
> >Hi All
> >I have written an application where in i need to call a

> FORM,MACRO and then
> >a VBA.
> >Inside a Macro an Action RunCode is written which in

> turn calls a VBA code
> >written below
> >
> >intValue = DLookup("NumCount", "Query1Test")
> >
> >This query has a Where condition
> >
> >Query1Test:
> >SELECT Count(*) AS NumCount FROM DelMastTemp
> >WHERE (((DelMastTemp.CustomerID)=Forms!Forms_DAR!

> Driver_Control.Value) AND
> >(DelMastTemp.StartDate=Forms!Forms_DAR!

> StartDate_Control.Value));
> >
> >But this Where condition value is being passed frm my

> FORM to this Query.
> >If i run the Query alone i get a Parameter Value in that

> i pass the data nd
> >i get the Resul.
> >
> >But when i run through this Form it throws an exception.I

> know the reason
> >behind it .The VALUE in the query is not being passed

> from the FORM.How nd
> >where should i give my WHERE Condition so that my query

> works.
> >
> >Shall i have to give the where condition inside the

> DLookup() or HOW?
> >
> >I am hoping to receive mails frm u all.
> >
> >Regards
> >Vikash
> >
> >
> >
> >.
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA IIf(myCell.Value = Array(myCell2(1).Value, myCell2(2).Value,myCell2(3).Value,myCell2(4).Value) ,"OK","No Match) EagleOne@discussions.microsoft.com Microsoft Excel Programming 2 24th Apr 2009 11:25 PM
appear or add more form inside form , or inserting more textfield inside form wazza w via AccessMonster.com Microsoft Access Form Coding 7 7th Sep 2005 05:54 AM
Incorporte Query into VBA or Pass VBA Value to Query =?Utf-8?B?SmFtZXMgU3RlcGhlbnM=?= Microsoft Access VBA Modules 5 12th Nov 2004 01:28 AM
Passing value to modal child form in MS Access using VBA? Grahammer Microsoft Access Forms 6 4th Jul 2004 11:53 PM
Passing FORM value to my Query inside VBA vikash.verma Microsoft Access Reports 1 1st Apr 2004 03:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:53 AM.