473,654 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populate a field on a form from another field & update table

beacon
579 Contributor
Hi everybody,

I'm putting a database together at work for a committee, but one of their requirements is giving me trouble.

They want a table and a form that will track trips made by patients at a hospital. Two of the fields on the table, TripDate and DateValidation, also need to be on a form. I've got that part taken care of.

On the form, when the TripDate is entered, they want the DateValidation to be populated from the TripDate with the day of the week. For instance, if TripDate is 11/21/2008 they want Friday to appear in the DateValidation textbox and on the underlying table. Then they want me to disable the textbox so they can see what the day of the week is, but not allow users to change it.

Initially, I created the two textboxes and put
Expand|Select|Wrap|Line Numbers
  1. =Format([TripDate],"dddd")
in the control source property of the DateValidation textbox, but it isn't placing the value on the table.

I also tried using Before & After Update events for the TripDate and DateValidation textboxes (separately) with the following code:
Expand|Select|Wrap|Line Numbers
  1. dim myDate, weekDay
  2.  
  3. myDate = TripDate.Value
  4.  
  5. weekDay = Format([myDate], "dddd")
  6.  
  7. DateValidation.Value = weekDay
  8.  
I used the code above, or some small variation of it, but to no avail.

Does anyone have any ideas how I can implement this?

Thanks...
~ beacon
Nov 21 '08 #1
5 2921
RuralGuy
375 Recognized Expert Contributor
Since the DateValidation field seems to always be derived from another field in the record, there is absolutely *no* reason to waste disk space with the field. Simply calculate it in the query of the table and lock the control that displays it on the form.
Nov 21 '08 #2
beacon
579 Contributor
I took your advice, but I may be missing something.

I moved my =format expression to the query that was used to create the form, but that still isn't populating the textbox on the form for DateValidation.

This may show my lack of knowledge with Access, but does a textbox have to have a control source to a field on a table/query for it to show up on the table/query?

Can I have a field on a form that calculates the day based on the TripDate field and then set the value of another field that has a control source on the table/query to the field that calculated the day? Perhaps using hidden textboxes?
Nov 21 '08 #3
beacon
579 Contributor
How do I calculate it in the query of the table?
Nov 25 '08 #4
RuralGuy
375 Recognized Expert Contributor
Format([TripDate],"dddd") As TripDay in the query
and then bind TripDay to your TextBox control
Nov 25 '08 #5
beacon
579 Contributor
Ok...I understand now. Thanks for your patience!
Nov 26 '08 #6

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

Similar topics

4
26186
by: N. Graves | last post by:
Hello... thank you for your time. I have a form that has a List box of equipotent records and a sub form that will show the data of the equipment select from the list box. Is it possible to make a change in the name field in the details, then refresh the list box with new name? Please help and thanks!
1
1829
by: Jason Wood | last post by:
Hi everyone, I've a simple table containing member details. I've written a SELECT to select all the members. I've based the form on this select, using the from wizard. Once built I've disabled the MemberID key field on the form. Changing any of the fields on the form and then exiting the field effectively updates the field on the table.
1
3673
by: John Phelan-Cummings | last post by:
I'm not certain if this made the post. Sorry if it's a repeat: Using a Button to take an autonumber from one form to populate another autonumber field on another form. I have a Mainform "A" with a button and code that opens another Mainform "B" with a subform which has the same table as Mainform "A". The button is supposed to tell the subform with the autonumber field
9
9682
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
1
7029
by: jeffro | last post by:
I have a database used for recording survey data. In the database, I have a form that displays a survey participant and a subform that is filled in by selecting a question from a looklist and then a response. The questions are held in a table and they are always the same. This is what I want to do. I want a button on the main form that can be clicked, When click, It will populate the survey detail table with the id of the record...
3
3612
by: jacklindsay | last post by:
Hello smarter people than me I am creating a database for college, and have requested some help, but they are unable to help me. ( im obviously too eager) anyway, im creating a database on computer components and peripherals (i.e networking devices, hard drives etc etc), the previous mentioned devices are in a table called product catagories which in the form, are a drop down. I also have 2 text box fields, 1 is for the product...
5
17676
by: joshua.nicholes | last post by:
I have an access database that consists of two tables.A data collection table and a species list table. The data collection table has about 1500 records in it and the species list has about 600. The species list has 7 fields the first is a four digit unique identifier (species) it is set as the primary key. I have created a relationship to the data collection table which also has a species field (4 digit id). In my form I have the species...
5
3913
FOE2272
by: FOE2272 | last post by:
I have tried every option that I can think of and most of them on this forum. The closest that I got was to bring up the field but it changed the other records based on what was chosen in one record. Details: DB with one main table and several list (reference) tables. I want to populate several list boxes on one form based on a choice from a combo box. Example: Tables:
0
1250
by: emrodge | last post by:
Hi, Any help appreciated on this one. I've set up a simple database with 4 tables & 3 forms. The tables link together on a field called "client id" which is the ID in a table called "Clients". I am trying to write some code behind a button on a form called "Membership & Fee Stats" which navigates to the associated Client record on the Clients form. I was getting an error when clicking the button where the . wasn't populated for some records...
0
8372
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8285
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8706
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8591
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7304
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2709
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
1915
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.