473,396 Members | 1,773 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,396 software developers and data experts.

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

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 1867
jimatqsi
1,271 Expert 1GB
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 Expert Mod 4TB
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
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
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 Expert Mod 4TB
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
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
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
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
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
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
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
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
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
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
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
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
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.