Connecting Tech Pros Worldwide Help | Site Map

Dynamic Form Field Query

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 09:04 PM
bob hicky
Guest
 
Posts: n/a
Default Dynamic Form Field Query

I have two tables (RadiationOncologists and EvaluationEntry) and forms
for each of the two. My problem is that I have a text box in the
RadiationOncologists form that is called Number. This field needs to
dynamically count each instance of a certain doctors name from the
EvaluationEntry table which is RADLNAME and return the total for each
doctor listed as there record in the RadiationOncologist Form appears.
I can do a count of all listed doctors by either total or from a
query that will list all of the drs with their totals but can't seem
to figure out how only do the calculation for the current doctor
listed.

Here is the SQL code i have to get the count to work

SELECT Count(EvaluationEntry.RADLNAME) AS CountOfRADLNAME,
EvaluationEntry.RADLNAME
FROM EvaluationEntry INNER JOIN RadiationOncologists ON
EvaluationEntry.RadID = RadiationOncologists.RadID
GROUP BY EvaluationEntry.RADLNAME;

I believe the group by could go away if there was a WHERE statement
stating to us the current RadiationOncologists.RADLNAME

  #2  
Old November 12th, 2005, 09:09 PM
Matthew Sullivan
Guest
 
Posts: n/a
Default Re: Dynamic Form Field Query

Bob:

You can refer to a control on an *open* form using this syntax:
Forms![FormName]![ControlName]

So, to get the count for only the doctor displayed, your SQL would
be something like:

SELECT Count(EvaluationEntry.RADLNAME) AS CountOfRADLNAME,
EvaluationEntry.RADLNAME
FROM EvaluationEntry
WHERE (EvaluationEntry.RADLNAME =
Forms![NameOfRadiationOncologistsForm!]![NameOfRADLNAMEControl]);

You could make that query the Record Source for a subform, and then
display the subform on the parent form that shows the
RadiationOncologists data.

-Matt


On 31 Mar 2004 18:18:29 -0800, hickykids@yahoo.com (bob hicky) wrote:
[color=blue]
>SELECT Count(EvaluationEntry.RADLNAME) AS CountOfRADLNAME,
>EvaluationEntry.RADLNAME
>FROM EvaluationEntry INNER JOIN RadiationOncologists ON
>EvaluationEntry.RadID = RadiationOncologists.RadID
>GROUP BY EvaluationEntry.RADLNAME;[/color]

  #3  
Old November 12th, 2005, 09:09 PM
bob hicky
Guest
 
Posts: n/a
Default Re: Dynamic Form Field Query

Matt,
Thanks so much, I figured out how to do it with an expression but this
clears up how to do it with a SQL query. Appreciate the help, sometimes
being a newbie is more painful on others than it is the newbie.

Rob




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4  
Old November 12th, 2005, 09:09 PM
bob hicky
Guest
 
Posts: n/a
Default Re: Dynamic Form Field Query

Matt,
Thanks so much, I figured out how to do it with an expression but this
clears up how to do it with a SQL query. Appreciate the help, sometimes
being a newbie is more painful on others than it is the newbie.

Rob


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #5  
Old November 12th, 2005, 09:10 PM
Matthew Sullivan
Guest
 
Posts: n/a
Default Re: Dynamic Form Field Query

Everyone was a noob once... ;-)

On 04 Apr 2004 06:17:32 GMT, bob hicky <hickykids@yahoo.com> wrote:
[color=blue]
>Matt,
>Thanks so much, I figured out how to do it with an expression but this
>clears up how to do it with a SQL query. Appreciate the help, sometimes
>being a newbie is more painful on others than it is the newbie.
>
>Rob
>
>
>*** Sent via Developersdex http://www.developersdex.com ***
>Don't just participate in USENET...get rewarded for it![/color]

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.