Solved

Auto update upon insert

Posted on 2002-06-19
4
211 Views
Last Modified: 2008-03-06
Is it possible to have access auto update field values based on what the user has already input.  For example, if there are three fields: A, B, C -> user is asked to input A and B, and have access then automatically update the value for C as the concatination of the string A+B.  Is there anyway to run an auto query as the values are inputted. This of course works in excel, but does it in access?

On an unrelated note, is there a way to use the date field for only month and year or would that have to be text.

Thanks
0
Comment
Question by:salibes
  • 2
4 Comments
 

Accepted Solution

by:
Deebz earned 70 total points
ID: 7092721
Place C.Requery in the onchange event of both fields A and B.  "C" will have to be created with field criterias limited by the value of A and B.  

You can create a Year/Month value from a date with this code:  Month([YourDate]) & "/" & Year([YourDate]).  Yes, it would turn it into a text field.
0
 

Author Comment

by:salibes
ID: 7093433
can C be a text box instead of a list box.  If yes, what is the code, and would i put it in control source?
0
 

Expert Comment

by:m_bizon
ID: 7093454
You could put a query in the control source for the listbox and use A and B as parameters of that query.  Make sure to use the [xxx] when refering to A and B controls in your query.  This would be if C resides in a table somewhere.

Another way to change the contents of listbox C based on A and B would be to write a subroutine that populates the list box useing listbox.item.add (I beleive that is the syntax).  Then use that sub as the change event on A and B.

Hope this helps.
0
 

Author Comment

by:salibes
ID: 7093475
Thanks,

but , I want to have a value show up in a text box , not listbox.  if in a listbox i want it to become default selected.  I'd rather have it in a textbox, is this possible?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now