473,394 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Populate Other Fields with Result after On Click Event

114 100+
Hi all,

I think I'm just blanking on some basic concept here...in Access 2003 on XP.
Here's the process - the user enters an ID number, clicks the command button, and the other two fields are filled with the result of two queries. How do I fill the other two fields? Details below...

I have a form (frmKeyAccounts) that contains three textboxes and one command button (see below):

txtClientID
txtOpenNoticesCount
txtClosedNoticesCount
cmdCountNotices

frmKeyAccounts VBA
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdCountNotices_Click()
  2. On Error GoTo Err_cmdCountNotices_Click
  3.  
  4.   Dim stQryName1, stQryName2 As String
  5.  
  6.   stQryName1 = "qryOpenNotices"
  7.     DoCmd.OpenQuery stQryName1, acNormal, acEdit
  8.       stQryName2 = "qryClosedNotices-90"
  9.     DoCmd.OpenQuery stQryName2, acNormal, acEdit
  10.  
  11. Exit_cmdCountNotices_Click:
  12.     Exit Sub
  13. Err_cmdCountNotices_Click:
  14.     MsgBox Err.Description
  15.     Resume Exit_cmdCountNotices_Click
  16.  
  17. End Sub
I have two queries that run with the On Click event of the command button (qryOpenNotices, qryClosedNotices-90). Both queries do count based on the client ID entered into txtClientID (full SQL below).

qryOpenNotices SQL
Expand|Select|Wrap|Line Numbers
  1. SELECT COUNT(tblNoticeBase.NoticeID) AS [Open Notices]
  2. FROM tblNoticeBase
  3. WHERE tblNoticeBase.ClientID Like (Forms!frmKeyAccounts!txtClientID) And ((tblNoticeBase.Status) Is Null Or (tblNoticeBase.Status)="U");

qryClosedNotices-90 SQL

Expand|Select|Wrap|Line Numbers
  1. SELECT COUNT(tblNoticeBase.NoticeID) AS [Closed Notices - 90 days]
  2. FROM tblNoticeBase
  3. WHERE tblNoticeBase.ClientID Like (Forms!frmKeyAccounts!txtClientID) And ((tblNoticeBase.Status)="R") And tblNoticeBase.DTRes Between (Now()) And (Now()-90);
How do I fill txtOpenNoticesCount and txtClosedNoticesCount based on txtClientID by the On Click event of cmdCountNotices? Thanks!
Dec 10 '07 #1
1 2126
Rabbit
12,516 Expert Mod 8TB
You can either use a recordset or the DLookup() function.
Dec 10 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Japhy | last post by:
Hello, I'm am pulling data from a mysql db and want to use the data to populate a <ul. Here are relavent parts of my code : $wohdate = mysql_result($wohRS,$wohndx,woh_date); $woh_display...
2
by: L Mehl | last post by:
Hello -- A form adds records for an account and an entry date pre-selected by the user. I use the Load event to get those 2 fields to appear in the form when it is first displayed. Problem...
6
by: Joe | last post by:
I have 2 multi-list boxes, 1 displays course categories based on a table called CATEGORIES. This table has 2 fields CATEGORY_ID, CATEGORY_NAME The other multi-list box displays courses based on...
4
by: Mike L | last post by:
I'm open for any suggestions on how to better program this. I want the user to select a license from a combo box, cboPrivilege and then the user will click the add button, then a record will be...
7
by: ero | last post by:
Is it possible to input values into a web form from an external source like a client-side javascript? There is a web site that I'm viewing where I have to enter 5 values in the form. 4 of the...
13
by: Selesti | last post by:
I have written an Access database that our department uses to store and analyze information on particular jobs. Because our company runs on an enormous SQL DB, I thought it would save some time if...
1
by: indhu | last post by:
Hi all, I want 2 know, how to populate using 2 combo box to populate other field. right now am using click event of combo to populate the other field but i want to select both combo1 and combo2 ...
1
by: jxt1303 | last post by:
Hello, I need to populate a listbox, based on the result from a parameratized query, which gets its parameter from the ActiveX Calendar control. So first, I don't know how to execute a...
1
by: ramel | last post by:
Hi all, I have a problem related to javascript , ajax and jsp. Please see this url http://xil.co.in/print_screen_2.JPG. I am working on this form. There are some buttons (like submit ,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.