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

Retain fields

75
HI Folks,

I have a question. On one of my Access form, I want to retain some certain fileds (Like name, ID etc) in the form, when user click ot add a new record?
I want to show name, ID # to be transfred to the next record, where user dont have to enter username and ID over and over.

If its a new name and new ID, then user can delte that and enter a new info, and this new name will carryover to the new record.

I hope i explained my question.........

please help me..
Thx
Feb 29 '08 #1
6 1884
missinglinq
3,532 Expert 2GB
You need to assign the fields you want to carry forward to their individual DefaultValues in their AfterUpdate events. The syntax varies according to their datatype.

For Text fields

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourTextControlName_AfterUpdate()
  2. If Not IsNull(Me.YourTextControlName.Value) Then
  3.   YourTextControlName.DefaultValue = """" & Me.YourTextControlName.Value & """"
  4. End If
  5. End Sub
  6.  
For Numeric fields

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourNumericControlName_AfterUpdate()
  2. If Not IsNull(Me.YourNumericControlName.Value) Then
  3.   YourNumericControlName.DefaultValue = Me.YourNumericControlName.Value
  4. End If
  5. End Sub
For Date fields

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourDateControlName_AfterUpdate()
  2. If Not IsNull(Me.YourDateControlName.Value) Then
  3.   YourDateControlName.DefaultValue ="#" &  Me.YourDateControlName & "#"
  4. End If
  5. End Sub
  6.  
Linq ;0)>
Feb 29 '08 #2
pukhton
75
Great...It worked...

Thanks for your help
Feb 29 '08 #3
missinglinq
3,532 Expert 2GB
Glad we could help!

Linq ;0)>
Feb 29 '08 #4
pukhton
75
All the other fields are working expect the date field.
Any idea why?

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Date_AfterUpdate()
  3. If Not IsNull(Me.Date.Value) Then
  4.   Date.DefaultValue = "#" & Me.Date & "#"
  5. End If
  6.  
  7. End Sub
  8.  
  9.  
Mar 3 '08 #5
pukhton
75
Can someone please explain why my date field is not WORKING? I tried every single thing...



All the other fields are working expect the date field.
Any idea why?

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Date_AfterUpdate()
  3. If Not IsNull(Me.Date.Value) Then
  4.   Date.DefaultValue = "#" & Me.Date & "#"
  5. End If
  6.  
  7. End Sub
  8.  
  9.  
Mar 4 '08 #6
missinglinq
3,532 Expert 2GB
Date is an Access Reserved Word and a very special one! It should never be used as an object name! Change your textbox named Date to something else, like txtDate, then check your systems's date! Take a peek here for the reason why:

http://www.thescripts.com/forum/thread659167.html

Linq ;0)>
Mar 4 '08 #7

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

Similar topics

3
by: Mark R | last post by:
I have one .asp page with a SELECT pulldown list on it and some INPUT fields. When SUBMIT is clicked the form data is submitted to that same page and validated. If INPUT fields are empty the asp...
5
by: samik_tanik | last post by:
I need to export a datagrid to Excel. I could did this. But, also need to keep the leading zeros in the data. How can I acheive this? Any help would be appreciated. -- Thanking you in...
0
by: Alfred Salton | last post by:
I have a dynamic form that is managed entirely on the browser side (that is fields are added and removed without a postback). The page the form is on requires a login. When the user submits the...
1
by: Harinath | last post by:
Hi All, I am working on a portal using .net2.0. In one of my page, i have FileUpload control. I am doing some server side validation for form fields in general. if there is any validation...
6
by: Happy YN | last post by:
in a Db there are 2 fields which contain 'matching' data. (there are other columns too) A Genesis B Exodus C leviticus D Numbers E Deutronomy I want to shuffle both columns so they are both...
2
by: ACF | last post by:
Hello, I'm having two memo fields beside each other for translating purposes. When I scroll down the text in Memo 1 to see what I want to translate, then move to Memo 2 to actually translate the...
5
by: teerock | last post by:
Hello fellow PHPers, I am relatively new to PHP but have come a long way in a short time and consider myself a fast learner. My application requires the user to enter information into forms on a...
3
by: raaman rai | last post by:
Hi Fellas, i need to understand how to retain the submtted form values during an Edit/Update operation. When i add the information from a form, i retain the form values in the following way incase...
4
by: pankajsingh5k | last post by:
Hi guys, These question is for all the experts... Please help me before my brain explodes The problem is again with the formview control.. I have a formview and i have to use it that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.