473,490 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do you keep a field in a form the same after update?

7 New Member
I am creating a database to track patient attendance.

I am entering data using a form.

The "Group Name" is an item in a listbox. How do I keep the Group Name the same so user does not have to click it for each patient's entry?
Mar 20 '14 #1
6 1868
jimatqsi
1,271 Recognized Expert Top Contributor
Hi LoveDad, welcome to Bytes.com.

Is Group Name the same thing for every patient? Or does it change from time to time? Assuming it is not a constant value, you could make the list box or whatever that is you refer to when you say "click it", make that object unbounded. Let's say it is a list box called "GroupName_list". In the form's OnCurrent event you could put this code:
Expand|Select|Wrap|Line Numbers
  1. if Len(nz(me.PatientGroupName_txt))=0 then me.PatientGroupName_txt=me.GroupName_list 
That assume's that each patient's group name is in a text box. The same code would also work in the form's BeforeInsert event

Jim
Mar 20 '14 #2
zmbd
5,501 Recognized Expert Moderator Expert
LoveDad

As you can see from Jimatqsi reply, we're just guessing at an answer right now. We need a little more detail about how your database is setup and in what version of Office/Access.

To start with, what is your level of experence with Access?
If you are just starting out, I have basic set of links and tutorials that I can PM you that once you work thru them you'll have the basics down.

Is your datbase normalized? > Database Normalization and Table Structures.
That is to say, are you using one huge table like one would see in the typical worksheet (ie Excel) or have you taken the time to break things down into tables of related data and then established the table relationships.

In ACC2007/2010 there are lookup fields that can be used at the table level. These are best avoided unless you are going to be creating a database that will be posted to a sharepoint site. To create table relationships one needs to go thru the database tools and use the table relationships tool or establish this via VBA (which is a pain IMHO).

In ACC2010 when creating forms, it is best to avoid the control wizard as it creates Macros behind the controls and not VBA code. Once again, if this is going to be posted to a sharepoint site this is your only option; however, the Macro language is limited in functionality when compared to the VBA scripting. Keep in mind, VBA and Macro in Access are NOT the same thing - and until just recently, they had very limited interaction.

Although not required; an abstract covering the goal of the database would be nice, it helps keep us on task...
When you say attendance, are you just tracking days, or sessions, etc... nothing too deep, just the basics.

We need to know if your form and its controls are bound or unbound to your data tables.

Finally, at this point in time please don't attach any files unless asked for by one of the experts or moderators. Most of the time we can help you without these files. If you do need to attach an image, please use the [advanced] button below the post box.
Mar 20 '14 #3
LoveDad
7 New Member
The "Group Name" is the same for patients that attended that group on that day only. The "Group Name" would change for each group attended.

I am pretty new to Access, but using online help and looking at some of my Dad's old code I have been able to figure quite a few things out.

I have created a word doc with a screen shot and additional details if you would like me to post it.
Mar 20 '14 #4
LoveDad
7 New Member
I am not quite a beginner, but not an expert either. My Dad was an expert, and my mentor. Unfortunatelly he passed away a couple years ago.

The goal of the database is to track patient's attendance in various groups. The history data will be used to create a quarterly summary note for each patient.

The database also prints an attendance list for each group and a list of all quarterly notes due for that month.

I have two main tables, tblPatient and tblHistory. I have also created several smaller tables to support list boxes. Perhaps due to my limited knowledge, each "Group Name" has its own small table.

I have 98% of it working. Unfortunately, some of co-workers are complaining that they have to click the "Group Name" for each entry.

I cannot provide you with the database as there is a lot of confidential data in it. I have created a word document that might help explain what I am looking for if you would like me to attach it.
Mar 20 '14 #5
zmbd
5,501 Recognized Expert Moderator Expert
No need to attach anything yet.
BTW: bmp/gif/jpeg/etc... Images can be attached "as is" using the advanced editor window - no need to zip nor include them within a document, just click on the [advanced] button at the bottom of the post and upload (Provided the meet the listed conditions (^_^) )
As for the text in the word file - I don't think that will be needed at this point in time. Normally, we would prefer that material to be posted as most of us will not d/l files.

Before we re-invent the wheel so to speak, I've used several of the the following methods, a tweek provided by MS, and parent/child forms to ease this type of data entry etc:

1st) Try using the Keyboard if the number of records you want to fill is relatively small.

1.Open a form in Form or Datasheet view, a query in Datasheet view, or a report in Print Preview and scroll to a new record.
2.Click the field in which you want to insert the value.
3.Press CTRL+APOSTROPHE (').

2nd is Allen Browne's method: Assign default values from the last record I recomend that you read thru the entire page.

3rd is a method I've used from ACC97 days, there's a hidden unbound text control on the form. The default value is a list of the control names that have the values to be copied down.
The form's on_current event calls a function that looks for the unbound control, pulls the list, then for each control in this list, the form's recordset for the last modified record is used as the data source. For some reason, I can't find the link for that now and the one I had is DOA. Sigh.

4th and the method I try to use is a form\subform arrangement so that once the parent form has the record of interest then the subform is used to enter the related data. I've attached a simple example of this Open frmtblpuke1, here you can see how using the parent will help you enter the related records in the child table... this is just for concept, you'll have to adapt for your database.

I also have a little list of tutorials and resources that you might find usefull as a refresher and addition to your "toolbox" - I'll PM these to you at your request.
Attached Files
File Type: zip BytesThread_955552_ParentChildExample.zip (234.9 KB, 68 views)
Mar 20 '14 #6
LoveDad
7 New Member
Thank you so much for all of your help. I have one more question (for now). I will post it separately.
Mar 21 '14 #7

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

Similar topics

4
4270
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field...
0
2190
by: Jim C Nguyen | last post by:
I have a table with ~2.2 million rows. Sometimes when I do an update to one single row it will instead update ALL of the rows using the same update. This happens every one in about 500,000...
1
2939
by: Jason | last post by:
I have a main form with a sub form. All the fields in the subform are mandatory. I had some code on the main form Before Update Event to check if all the fields in the sub form have data. If not, I...
1
1322
by: Edwin Knoppert | last post by:
I created a table with an ID bigint autonumber and 3 more ordinary TEXT fields. Only the first field will never update via the gridview. I create an empty row through the sqldataadapter, the row...
5
6792
by: Shane | last post by:
How do you keep a form on top of an application only. I know that I can use "TopMost" to keep a form on top of the other forms, but that solution is Windows scope instead of only my application...
8
3250
by: ivijayan | last post by:
HI. I have the following query:- How do i create field which updates its contents on the basis of data in another field in same record. especially if I have a Date field, how can I change the...
7
27531
by: rpeacock | last post by:
I was curious to know if it is possible to run an Update query by passing the field name as a variable for updating. The simple example should make more sense. Basically I am trying to change the...
1
10265
by: Edy Chandra | last post by:
Hi, I'm doing a simple application for store. In my subform when I want to entry the record MS Acces appear msg "Field cannot be update". I've try to solve it with the possible causes (as show on...
2
5510
by: Gerald Taylor | last post by:
Please excuse any idiotic questions as Access/VBA is a new area to me. I have inherited an Access Database/Application that is used to sign in and out visitors and Staff to our community Centre....
8
6832
by: Lucrecious | last post by:
How do I create a dynamic report based on a query that updates from a select field form? I followed the information from the article here entitled: "Checkbox form to allow user to select query output...
0
6967
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
7142
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,...
0
7181
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...
1
6847
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...
0
7352
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...
0
5445
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,...
1
4875
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...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.