473,517 Members | 2,859 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AfterUpdate to populate field after data entry into two other fields.

8 New Member
I have:

tbl_Consolidated with [LName], [FName], [Last4], [EmpID]

qry_EmpID with "EmpID: UCase([L Name]&[Last 4])"

frm_AdminData to fill in the last name, first name, and last four.

What I want is this:

After I fill in LName and Last4 on the form, I want it to automatically populate the EmpID query and fill in the form's EmpID field.

Example: I have Smith, Mike 1234. After I type in Smith and 1234 into their appropriate fields on the form, I want the EmpID field to show SMITH1234

I know this would be an AfterUpdate function, but cannot figure out exactly how to compose this action.
Oct 6 '11 #1
6 2462
patjones
931 Recognized Expert Contributor
My immediate reaction when reading your request was that you don't need the query. This however then led me to consider if you want this process to occur only for people who are in the table. Is this the case?

I ask because it's possible to write code that will concatenate the values from the first two text boxes, upper case the value, and write it to the third box...regardless of whether the first two values are in the table or not.

Pat
Oct 6 '11 #2
ivchisholm
8 New Member
I already have people in the database. I would like for this to populate the [EmpID] field for already existing records, as well as for new records as they are created.

Furthermore, I don't just want it to concatenate the two fields into the third field on the form...I want to store this within the [EmpID] field on the table, as well.
Oct 6 '11 #3
patjones
931 Recognized Expert Contributor
You should first write an UPDATE query that will populate the EmpID field for all existing records. Once that's done...

On the form, you will want to do as I suggest in post #2, paragraph 2. At that point, there are two possibilities. Either the value in the third text box is already in the table, in which case you do nothing...OR that value is not found (new employee) - in which case you need to run an append query to add that person to the table.

By the way, if this is for primary key generation, it's not a good choice for a primary key. I would suggest finding other possibilities.

Pat
Oct 6 '11 #4
ivchisholm
8 New Member
Yes, unfortunately, this is to generate a primary key. I had a discussion about this with someone earlier today about this.

I say unfortunately, because, even though I understand the lack of uniqueness of last names and last four, it is necessary/possible for 2 primary reasons: (1) It will only have about 300 records at a given time, so likelihood of duplicating is minimal/negligible and (2) people in higher position want it that way, although advised on the possibility. They look at the chances as being minimal, therefore acceptable.

By the way, in the next few years we will have a more permanent database to replace this one that (hopefully) will be better designed than the one I am trying to work with. This one was here when I got here, and I have ripped out a bunch of needless and senseless stuff and made it less complicated.
Oct 6 '11 #5
patjones
931 Recognized Expert Contributor
I see; at least you're aware of what you're doing and that it could present a problem somewhere down the road. It sounds like other arrangements will be made when the permanent database comes online.

So, I would proceed as suggested before: concatenate the values into the third text box and then do a check to see if it's in the table, with an INSERT taking place if it is not in the table. Let us know if you need assistance with this process.
Oct 6 '11 #6
NeoPa
32,558 Recognized Expert Moderator MVP
This thread was essentially a duplicate of one already in play at Combine two fields into another field within SAME table.

To leave this as tidily as possible I'm locking this thread, so anyone involved can continue in the other one.
Oct 6 '11 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4125
by: Iain Miller | last post by:
Struggling a bit here & would be grateful for any help. I have a table which has a list of people in it. Each person has a unique ID automatically allocated by Access but also belongs to one of 5 Groups - call them A to E. I'd like to generate a further automatic reference number based on something like Group/Unique ID so when I create a...
2
3025
by: Kevin Myers | last post by:
Hello, Have yet another problem on a form that has me stumped. In a table that I am working with, the values for one of the fields are stored in meters. However the values that are supplied for data entry are in feet. Therefore, I don't believe that I can use a bound text box to support the entry of data for this field. I could use an...
2
2027
by: edworboys | last post by:
I have designed a data entry form with a number of fields and a sub form. The first field (Country) is a combo box and the user selects a country. This, in turn reduces the number of options in the second field (Prospect Name). The user then uses the subform to enter a document location. The problem is this:
16
5806
by: jhwagner | last post by:
I need to use double data entry with an MS Access database. I have read many arguments and reasons against this on this group but I have to do this. I have seen various tips on how this can be done including the use of queries but this hasn't worked satisfactorily. I have two people who know Access just barely enough to enter the data so...
2
5036
by: filbennett | last post by:
Hi Everyone, I'm generally unfamiliar with Access form design, but have programmed Cold Fusion applications for a couple of years. I'd like to build a data entry form in Access that allows the following. First, the data schema: Three tables are involved. The first is a PERSONS table which has two fields, SSNUMBER (primary key), and...
17
3503
by: Timothy.Rybak | last post by:
Hello all, This is my first attempt at an application, so kid gloves are appreciated. I need to make a very simple form that only has a few elements. One is TraceCode - a text field that is populated when a user scans a label. The other is ScanDate - a date/time field that should equal the date/time of the scan (e.g. 7/31/2006 5:00:00...
4
3169
by: Birky | last post by:
I’m hoping you can help me get my form to work. I have a few issues that I need to get squared away. 1. I am using a form for data entry only therefore I need the form to pop with the next available record. If I can get the form to load and be ready for input, making it as simple as possible for the user to enter records without having to...
20
6881
by: hippomedon | last post by:
Hello everyone, I'm looking for some advice on whether I should break the normalization rule. Normally, I would not consider it, but this seems to be a special case. I have created an "Outcomes Database" used to store response data from measures/ questionnaires for a longitudinal health study. It is essentially derived from Duane...
8
2916
by: Wingot | last post by:
Hey, I have a program I am trying to write using Visual C#, SQL Server 2005/2008, and Visual Studio 2008, and one part of it includes a Schema called Client. Inside this schema, three tables exist named Country, MedicalCondition, and Customer.
5
2999
by: Dan Tallent | last post by:
I have a scenerio when my forms are first opened that the user cannot modify the data. The fields are disabled to prevent them from modifying any of the data. If a user wishes to modify the data he would be required to click a "Edit" button which will test permissions or status information of the record. If the application determines it...
0
7295
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7197
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7430
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7556
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5120
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3277
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1641
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
833
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.