Can (or how can) I do this

Hello,

My Access application tracks an employee's progress through a process 
similar to hiring.  There are 5 steps in the process.  I track 4 of the steps 
by counting the number of times a value appears in a date field for that 
step.  The count is then displayed and used in a calculation.  The 5th step 
is more complicated.  The 5th step needs to determine if the employee has 
verified that he can access all the applications that he should have access 
to.

My process tracking table has the first 4 dates.  The application access 
info comes from a different table.  This process tracking table also has a 
field to store the count of the number of applications where access has been 
verified.  On the form to do all this, I use the Forms' current event to work 
with the four dates.  This is all set and working fine.  But for the 
application access, I need to run a query against the 2nd table to get a 
count, then get the count stored in the process tracking table.
After I have the count in the process tracking table, I can do the necessary 
calculations to determine a "percentage of hiring process completed".

How can I run that query and get the value back to the table?

My query to get the count looks like:
SELECT Count (*)
FROM <tblName>
WHERE EmplNum = Me.EmplNum

What I need should look something like this (Syntax is not correct)
Update tblProcessTracking
Set AppsVerifiedCount = 
   Select Count(*)
   FROM <tblName>
   WHERE EmplNum = Me.EmplNum

Can I do this?  If not, can someone help me with how to accomplish this?

Thanks in advance,


0
Utf
9/18/2007 3:52:07 PM
access.queries 6343 articles. 1 followers. Follow

3 Replies
879 Views

Similar Articles

[PageSpeed] 45

You can't use aggregate queries in an update query.  You can use the VBA 
Aggregate functions.  My question is why do you want to record the data in a 
table when you can always get the needed value using a query and always know 
that the value is current?

Update tblProcessTracking
Set AppsVerifiedCount = DCOUNT("*","tablename","EmplNum=""" & 
tblProcessTracking.EmplNum & """"

Add a where clause to restrict the records that get updated

But you can also have the value available by simply using DCOUNT function or 
using a subquery  such as
SELECT *,
(SELECT Count(*) FROM TableName
WHERE TableName.EmplNum = tblProcessTracking.EmplNum) as CountTimes
FROM tblProcessTracking

John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"rich" <rich@discussions.microsoft.com> wrote in message 
news:DA355A77-FFBF-424D-9940-38E2757EBED1@microsoft.com...
> Hello,
>
> My Access application tracks an employee's progress through a process
> similar to hiring.  There are 5 steps in the process.  I track 4 of the 
> steps
> by counting the number of times a value appears in a date field for that
> step.  The count is then displayed and used in a calculation.  The 5th 
> step
> is more complicated.  The 5th step needs to determine if the employee has
> verified that he can access all the applications that he should have 
> access
> to.
>
> My process tracking table has the first 4 dates.  The application access
> info comes from a different table.  This process tracking table also has a
> field to store the count of the number of applications where access has 
> been
> verified.  On the form to do all this, I use the Forms' current event to 
> work
> with the four dates.  This is all set and working fine.  But for the
> application access, I need to run a query against the 2nd table to get a
> count, then get the count stored in the process tracking table.
> After I have the count in the process tracking table, I can do the 
> necessary
> calculations to determine a "percentage of hiring process completed".
>
> How can I run that query and get the value back to the table?
>
> My query to get the count looks like:
> SELECT Count (*)
> FROM <tblName>
> WHERE EmplNum = Me.EmplNum
>
> What I need should look something like this (Syntax is not correct)
> Update tblProcessTracking
> Set AppsVerifiedCount =
>   Select Count(*)
>   FROM <tblName>
>   WHERE EmplNum = Me.EmplNum
>
> Can I do this?  If not, can someone help me with how to accomplish this?
>
> Thanks in advance,
>
> 


0
John
9/18/2007 4:37:09 PM
Hi John,

Thanks for the reply.

I don't necessarily need to store the value.  I thought it would make things 
easier but I can easily remove it.

I'm still a little confused so I'd like to make sure I'm understanding you 
correctly.

My master form has 2 txtboxes to display the count that I'm after (and the 
total # of apps).  Do I set the Control Source = the DCount statement which 
then looks like this:

DCount("*", "tblEmplApplMapping", "S3ID = '" & Me.S3ID & "'")

I'm still getting comfortable with the syntax so the SQL statement would 
look like:
Select Count(*)
FROM tblEmplApplMapping
WHERE tblEmplApplMapping.S3ID = Me.S3ID

OR

should I use the master-form's On Current event and say the txtbox = the 
DCount?

thanks,
Rich




"John Spencer" wrote:

> You can't use aggregate queries in an update query.  You can use the VBA 
> Aggregate functions.  My question is why do you want to record the data in a 
> table when you can always get the needed value using a query and always know 
> that the value is current?
> 
> Update tblProcessTracking
> Set AppsVerifiedCount = DCOUNT("*","tablename","EmplNum=""" & 
> tblProcessTracking.EmplNum & """"
> 
> Add a where clause to restrict the records that get updated
> 
> But you can also have the value available by simply using DCOUNT function or 
> using a subquery  such as
> SELECT *,
> (SELECT Count(*) FROM TableName
> WHERE TableName.EmplNum = tblProcessTracking.EmplNum) as CountTimes
> FROM tblProcessTracking
> 
> John Spencer
> Access MVP 2002-2005, 2007
> Center for Health Program Development and Management
> University of Maryland Baltimore County
> ..
> 
> "rich" <rich@discussions.microsoft.com> wrote in message 
> news:DA355A77-FFBF-424D-9940-38E2757EBED1@microsoft.com...
> > Hello,
> >
> > My Access application tracks an employee's progress through a process
> > similar to hiring.  There are 5 steps in the process.  I track 4 of the 
> > steps
> > by counting the number of times a value appears in a date field for that
> > step.  The count is then displayed and used in a calculation.  The 5th 
> > step
> > is more complicated.  The 5th step needs to determine if the employee has
> > verified that he can access all the applications that he should have 
> > access
> > to.
> >
> > My process tracking table has the first 4 dates.  The application access
> > info comes from a different table.  This process tracking table also has a
> > field to store the count of the number of applications where access has 
> > been
> > verified.  On the form to do all this, I use the Forms' current event to 
> > work
> > with the four dates.  This is all set and working fine.  But for the
> > application access, I need to run a query against the 2nd table to get a
> > count, then get the count stored in the process tracking table.
> > After I have the count in the process tracking table, I can do the 
> > necessary
> > calculations to determine a "percentage of hiring process completed".
> >
> > How can I run that query and get the value back to the table?
> >
> > My query to get the count looks like:
> > SELECT Count (*)
> > FROM <tblName>
> > WHERE EmplNum = Me.EmplNum
> >
> > What I need should look something like this (Syntax is not correct)
> > Update tblProcessTracking
> > Set AppsVerifiedCount =
> >   Select Count(*)
> >   FROM <tblName>
> >   WHERE EmplNum = Me.EmplNum
> >
> > Can I do this?  If not, can someone help me with how to accomplish this?
> >
> > Thanks in advance,
> >
> > 
> 
> 
> 
0
Utf
9/18/2007 5:38:01 PM
You should be able to use the Dcount statement as a control's source./  You 
cannot use a query as a control's source.

Sorry, for the short answer.  Gotta go - time to pick up the grandkids.

-- 
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"rich" <rich@discussions.microsoft.com> wrote in message 
news:1EDC787A-943C-4581-A7AB-AC6C4312A7F9@microsoft.com...
> Hi John,
>
> Thanks for the reply.
>
> I don't necessarily need to store the value.  I thought it would make 
> things
> easier but I can easily remove it.
>
> I'm still a little confused so I'd like to make sure I'm understanding you
> correctly.
>
> My master form has 2 txtboxes to display the count that I'm after (and the
> total # of apps).  Do I set the Control Source = the DCount statement 
> which
> then looks like this:
>
> DCount("*", "tblEmplApplMapping", "S3ID = '" & Me.S3ID & "'")
>
> I'm still getting comfortable with the syntax so the SQL statement would
> look like:
> Select Count(*)
> FROM tblEmplApplMapping
> WHERE tblEmplApplMapping.S3ID = Me.S3ID
>
> OR
>
> should I use the master-form's On Current event and say the txtbox = the
> DCount?
>
> thanks,
> Rich
>
>
>
>
> "John Spencer" wrote:
>
>> You can't use aggregate queries in an update query.  You can use the VBA
>> Aggregate functions.  My question is why do you want to record the data 
>> in a
>> table when you can always get the needed value using a query and always 
>> know
>> that the value is current?
>>
>> Update tblProcessTracking
>> Set AppsVerifiedCount = DCOUNT("*","tablename","EmplNum=""" &
>> tblProcessTracking.EmplNum & """"
>>
>> Add a where clause to restrict the records that get updated
>>
>> But you can also have the value available by simply using DCOUNT function 
>> or
>> using a subquery  such as
>> SELECT *,
>> (SELECT Count(*) FROM TableName
>> WHERE TableName.EmplNum = tblProcessTracking.EmplNum) as CountTimes
>> FROM tblProcessTracking
>>
>> John Spencer
>> Access MVP 2002-2005, 2007
>> Center for Health Program Development and Management
>> University of Maryland Baltimore County
>> ..
>>
>> "rich" <rich@discussions.microsoft.com> wrote in message
>> news:DA355A77-FFBF-424D-9940-38E2757EBED1@microsoft.com...
>> > Hello,
>> >
>> > My Access application tracks an employee's progress through a process
>> > similar to hiring.  There are 5 steps in the process.  I track 4 of the
>> > steps
>> > by counting the number of times a value appears in a date field for 
>> > that
>> > step.  The count is then displayed and used in a calculation.  The 5th
>> > step
>> > is more complicated.  The 5th step needs to determine if the employee 
>> > has
>> > verified that he can access all the applications that he should have
>> > access
>> > to.
>> >
>> > My process tracking table has the first 4 dates.  The application 
>> > access
>> > info comes from a different table.  This process tracking table also 
>> > has a
>> > field to store the count of the number of applications where access has
>> > been
>> > verified.  On the form to do all this, I use the Forms' current event 
>> > to
>> > work
>> > with the four dates.  This is all set and working fine.  But for the
>> > application access, I need to run a query against the 2nd table to get 
>> > a
>> > count, then get the count stored in the process tracking table.
>> > After I have the count in the process tracking table, I can do the
>> > necessary
>> > calculations to determine a "percentage of hiring process completed".
>> >
>> > How can I run that query and get the value back to the table?
>> >
>> > My query to get the count looks like:
>> > SELECT Count (*)
>> > FROM <tblName>
>> > WHERE EmplNum = Me.EmplNum
>> >
>> > What I need should look something like this (Syntax is not correct)
>> > Update tblProcessTracking
>> > Set AppsVerifiedCount =
>> >   Select Count(*)
>> >   FROM <tblName>
>> >   WHERE EmplNum = Me.EmplNum
>> >
>> > Can I do this?  If not, can someone help me with how to accomplish 
>> > this?
>> >
>> > Thanks in advance,
>> >
>> >
>>
>>
>> 


0
John
9/18/2007 7:10:43 PM
Reply:

Similar Artilces:

How can I print a selection in Outlook 2003?
How can I print just a selection of an email in Outlook 2003? The printer driver window is different from the one that comes up in Outlook Express. Thank you! You can do this for HTML formatted messages. Highlight your text, File-> Print... and select to print only the selection -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the Outlook Icons Mean? -Create an Office 2003 CD slipstreamed with Service Pack 1 ----- "Murphie" <Murphie@discussions.microsoft.com> wrote in message news:92F39B50-B877-408A-AAA7-DF350B1D72ED@microsoft.com....

error: OBE-15502 Can only have 16000 per document
Hi, I tried to export data from oracle query builder to Excel sheet, got a error message: OBE-15502 Can only have 16000 per document Is there any way i can get more records(over 16000 or unlimited) in one sheet? thanks. -- JJ ...

Can't see 401(k) contribiltion total
I've set up a 401(k)accont. I transfer contribiltions to this 401(k)account from each paycheck. When I go to the 401 (k) account view, it shows all the informations such as transections and the account vallue ect., EXCEPT the total contribiltion. I want to know not only what my 401(k) vallue is, but how much money I have contribilt total or over a period of time as well. I find no place to see it. Anybody can help? I'm using Money2002 and 2004 Trial Verstion. Thanks a lot! ...

Can different editions of Publisher be used together?
If my son uses Publisher 2003 on a school computer, downloads his work to a flash drive, brings it home to edit on Publisher 2007, will he then be able to take the edited work back to the school computer to be used, or will it not be compatible? Stateparent wrote: > If my son uses Publisher 2003 on a school computer, downloads his work to a > flash drive, brings it home to edit on Publisher 2007, will he then be able > to take the edited work back to the school computer to be used, or will it > not be compatible? Publisher 2003 and 2007 share a common file format, so the sc...

Can't send/receive
anyone have a situation where all of sudden they can't send new messages or receive anything? I get a message when I click on "accounts" that says 'fatal error in outlook unable to complete operation" ...

Can I change the "Applied Task Update Requests and Errors" view?
I really like this view in PWA 2007, but I would like to replace one column with another. Is this view customizeable? Randy -- Bad news, my friend. This view is not customizable, nor is the view shown in the Task Updates customizable (which many users wish it was). Hope this help. -- Dale A. Howard [MVP] VP of Educational Services msProjectExperts http://www.msprojectexperts.com http://www.projectserverexperts.com "We write the books on Project Server" "Randy Schmid" <RandySchmid@discussions.microsoft.com> wrote in message news:72FA34B5-...

Should be an easy but I can not figure it out!!
I have a text box where the user enters a date and it is assigned to variable txtDate. How to I convert that to the serial number of the date? Thanks for the help IIRC, you can use DATEVAL(String) to get the serial date. -- HTH, Barb Reinhardt "VinceW" wrote: > I have a text box where the user enters a date and it is assigned to variable > txtDate. How to I convert that to the serial number of the date? > > Thanks for the help Barb, Thanks for the quick reply, however I get the error "Sub or Function not defined" when trying...

Can not Customize Leads View
Hi I have tried to customize the Leads view, I tried to add a view and add some columns to it. The view is shown however I see only the name column. When I go back to the View customization, I see the columns I added. Published your customizations??? -- ---------------------- regards, Ilya Milshtein MBS Master, MBSCP, MCP Softline International www.softline.ru "alsap" wrote: > Hi I have tried to customize the Leads view, I tried to add a view and add > some columns to it. > The view is shown however I see only the name column. > When I go back to the View customi...

Bulk attachments
I have a very long list of Images in a single folder that I want to attach to seperate fields in a table/form. Each record contains two images, which are named like this: W:\Foldername\Micromap Run 001 A.bmp =(1st record) W:\Foldername\Micromap Run 001 B.bmp =(1st record) W:\Foldername\Micromap Run 002 A.bmp =(2nd record) W:\Foldername\Micromap Run 002 B.bmp =(2nd record) W:\Foldername\Micromap Run 003 A.bmp =(3rd record) W:\Foldername\Micromap Run 003 B.bmp =(3rd record) and so on... Image A goes to field A Image B goes to field B Is there a way of doing this au...

can't uninstall exchange from cluster nodes
hi our client has several exchange clusters, and one of them is being retired. we have removed the exchange resources and the EVS and the server no longer appears in the organization and everything else there seems to be ok. we can't seem to uninstall exchange from either of the nodes. setup will start saying it's loading components then terminates with no error; happens on both nodes. both nodes are exchange 2003 sp1 on windows 2003. i did find the setup log; here is what it says, hope someone can shed some light on this (company info replaced with < >): [19:47:23] *...

Can't delete email #2
I'm am trying to help a friend who is using Outlook Express on W98, I cannot delete any messages from her in box. She has over 500 in there, which may be part of the problem. Any suggestions? Desperate! Mark Mark Ryan <m.ryan@earthlink.com> wrote: > I'm am trying to help a friend who is using Outlook Express > on W98, I cannot delete any messages from her in box. She > has over 500 in there, which may be part of the problem. > Any suggestions? The first suggestion is to ask in an Outlok Express newsgroup. The second suggestion is to delete Deleted Items.dbx and ...

Can Not Reply To Emails
Running Windows 7 Professional with latest version of WLM. I get email messages I can not reply to. The reply button is grayed out. For now I am forwarding them to my WinXP computer and then replying from that computer with OE6. Anybody have any ideas? -- <Bill> Brought to you from Anchorage, Alaska. The most obvious reason for not having an active Reply button is not having a mail account set up. --=20 Gary VanderMolen, Microsoft MVP (Mail) http://mvp.support.microsoft.com/default.aspx/profile/vandermolen "Bill Bradshaw" <bradshaw@gci.net>...

How can I rename a database table?
Hi I am working on a project that uses the MFC CDatabase and CRecordset classes to handle its interfacing with an Access database. It is necessary for the software to rename a table within existing user databases to ensure that they are valid for use with the new version of the software. As a result of my limited database and MFC knowledge I am having difficulty finding a way of renaming the table. I have tried using the following: try { theDataBase.ExecuteSQL( "RENAME oldTableName TO newTableName"); } catch( CDBException* e) { e->m_strError; } However, it results in th...

Can (or how can) I do this
Hello, My Access application tracks an employee's progress through a process similar to hiring. There are 5 steps in the process. I track 4 of the steps by counting the number of times a value appears in a date field for that step. The count is then displayed and used in a calculation. The 5th step is more complicated. The 5th step needs to determine if the employee has verified that he can access all the applications that he should have access to. My process tracking table has the first 4 dates. The application access info comes from a different table. This process trackin...

how can I restore unsaved changes in excel #2
...

Can Not Connect to Exchange Server after Mailbox Move
I have 2 exchange servers. While logged into the domain, and at the location, I can log into the email system just fine. While remote VPN in, I can not access the server. I can ping the server, I can see all shares, and I can even access the printer and print from the exchange server. But I can not get to it with email. Any Ideas? Oh.. both exchange 5.5, both in the same site. Exchange Admin shows both sites just fine. is there a firewall with rules configured, in between the users vpn connection and the internal network? kmelillo@gmail.com wrote: > Oh.. both exchange 5.5, bot...

Can not archive
I get the message "Error while archiving folder "Deleted Items" in store "mailbox-user name." Some items could not be copied. They were either moved or deleted, or access was denied. This only happend recently and only occurs with the deleted items. I can archive send and the inbox without a problem. Any suggestions? Thanks ...

can'not set or connect to an email account
This is a multi-part message in MIME format. ------=_NextPart_000_0010_01CAAC2C.BBDF6A00 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0011_01CAAC2C.BBDF9110" ------=_NextPart_001_0011_01CAAC2C.BBDF9110 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable I am triying to set an email account.I am vodafone mobile customer.Some = settings bloking my access to email service.I am not a professinal = computer user,following the the instractions but no luck.Can you help = me? Thank you. ------=_Nex...

Where can I download this type of db example?
Hi, I'm working in Access 2003. Where can I download a (free) Access database example that shows how to implement forms and queries for tables that break down many-to-many relationships with a link table? I understand normalization and I believe my structure is 3rd order normalized. I need to figure out how to input data into the tables and have them linked together automatically by a query (or, if necessary, VB code). In other words, a database that has tblParents (1->oo) tblParent_Child_LINK (1->oo) tblChildren where (1->oo) means One-to-many, if it wasn't c...

Can you convert picture into Visio?
Is there a way to convert picture into Visio format? If so, how? It would depend on what format the picture was in. For most cases, this is not an easy task. John... Visio MVP "tbae" wrote: > Is there a way to convert picture into Visio format? If so, how? ...

Can you....
Can you create a text box that pops up when you try to exit excel? would like a box that reminds people to fill out parts of a form whe they try to exit the workbook. Any ideas would be great -- Message posted from http://www.ExcelForum.com This code goes in the ThisWorkbook section of the VB Editor. Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim iResponse As Long iResponse = MsgBox("Did you enter everything? Click No to return an finish.", vbYesNo) If iResponse = 7 Then Cancel = True End Sub If the user clicks No, the application will not close. You coul modify...

Can you freeze columns in a list box?
I know you can freeze columns in a datasheet so that the columns remain on the leftmost side of the screen, but is there a way to do the same in a list box? I have a list box that displays 30 columns of information. It would be helpful if the first 4 didn't have to disappear when you scroll to the right. "agene" <agene@discussions.microsoft.com> wrote in message news:7AAE32B2-E08F-4F7F-9C5E-8B9CD2F806AE@microsoft.com... >I know you can freeze columns in a datasheet so that the columns remain on > the leftmost side of the screen, but is there a way to do the sa...

Can we Pop Cash drawer without slip printer?
We would like to install a cash drawer and have RMS pop the drawer without using a slip printer with a cash drawer connection port. We currently use an HP Laser printer connected to the serial port of our computer to print full sized receipts and I called Indiana Cash drawer to find out what type of interface we would need to get the program to "pop" the drawer and their support said I need to find out what code the software is sending to the drawer. According to RMS the SL, SLD and EL models are compatible but RMS does not indicate what type of interface is needed short of the OPO...

how can i protect a document so nobody can delete it #2
This question relates to any microsoft documentsand the document i want protecting is Excel. how can i protect it so nobody can delete the document. (the document itself rather than parts of the document) >-----Original Message----- >This question relates to any microsoft documentsand the document i want >protecting is Excel. > >how can i protect it so nobody can delete the document. (the document >itself rather than parts of the document) >. >You can password protect the whole document, so that nobody else can open it. But if it is on a server where other ...

What are AutoComplete default settings? Can I change them?
I am making a text list down 1 column of at least 1000 rows. I need Excel to continue to scan all entries for duplicate text. Does anyone know how many rows above and/or below an entry, does Excel do the AutoComplete and highlight the duplicate entry? Is it changeable ie: if Excel scans for 100 rows, can it be changed to scan 1000 rows? Thanks! Check http://www.excelforum.com/showthread.php?s=&threadid=219730 fo possible solution -- Message posted from http://www.ExcelForum.com ...