473,325 Members | 2,342 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,325 software developers and data experts.

Keeping Previous Default Value on Form-Help

I have a form and wish to keep the date entry from form to form.. Found code
that follows that says it should work in an afterupdate event.

Private Sub IDate_AfterUpdate()
Me!IDate.Default = Me!IDate
End Sub

Any suggestions why it does not work and what I need to make it work...

any help would be appreciated, thanks..
Nov 12 '05 #1
2 1911
1. The property name is "DefaultValue".

2. The property expects to be assigned a string value.

3. The literal date in the string should have # delimiters.

4. You probably want to skip the assignment if no date was entered.

Try something like this:

Private Sub Form_AfterUpdate()
With Me.IDate
If Not IsNull(.Value) Then
.DefaultValue = Format(.Value, "\#mm/dd/yyyy\#")
End If
End With
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"JC Mugs" <jc****@hotmail.com> wrote in message
news:vv************@corp.supernews.com...
I have a form and wish to keep the date entry from form to form.. Found code that follows that says it should work in an afterupdate event.

Private Sub IDate_AfterUpdate()
Me!IDate.Default = Me!IDate
End Sub

Any suggestions why it does not work and what I need to make it work...

Nov 12 '05 #2
Dear Allen,

That works great, thank you!
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:3f**********************@freenews.iinet.net.a u...
1. The property name is "DefaultValue".

2. The property expects to be assigned a string value.

3. The literal date in the string should have # delimiters.

4. You probably want to skip the assignment if no date was entered.

Try something like this:

Private Sub Form_AfterUpdate()
With Me.IDate
If Not IsNull(.Value) Then
.DefaultValue = Format(.Value, "\#mm/dd/yyyy\#")
End If
End With
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"JC Mugs" <jc****@hotmail.com> wrote in message
news:vv************@corp.supernews.com...
I have a form and wish to keep the date entry from form to form.. Found

code
that follows that says it should work in an afterupdate event.

Private Sub IDate_AfterUpdate()
Me!IDate.Default = Me!IDate
End Sub

Any suggestions why it does not work and what I need to make it work...


Nov 12 '05 #3

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

Similar topics

3
by: Bill | last post by:
Hi. I have a multi-page form where the user enters datails to be submitted to a database on the final page. To move through the pages I have Next and Previous buttons using the following...
2
by: Usenet | last post by:
I am not very experienced in MS-Access. I am trying to configure a text box in a form, so that it will take it's default value from the previous record. Could anyone please explain how this can be...
3
by: Greg Krzeszkowski | last post by:
Hi, This might be a little odd but I need to implement a back/"return to previous page" function from different pages within my asp.net application. The page the back button on has a property...
12
by: Ivan Weiss | last post by:
Hey guys, quick question. I am trying to create a form that is always maximized and is an MDI Child. When another form opens I want it to open (windowed) on top of this form which is still...
3
by: g3000 | last post by:
I have a problem with a Visual Studio 2005 web project. I have two pages. SelectProject.aspx and ShowProject.aspx The first page ( SelectProject.aspx) has two drop down lists. After the user...
0
by: visionstate | last post by:
Hi All, I have a few tiny problems left with my cascading combo boxes. Here is what my form looks like: http://img219.imageshack.us/my.php?image=databaseformwl5.png The way it works is by...
8
by: Jeff | last post by:
A client wants a press of the Enter key in a field on a continuous form to grab the value of that field from the previous record. But if they have typed a value and then hit Enter it shouldn't. ...
3
by: md9108 | last post by:
I have a previous page and next page coded. The next page works. The previous page gives me an http: 404 error and I can't figure it out. The error is on the line "<td align=left> <!-- ...
9
by: Brett_A | last post by:
I have a form where the first field is a dynamic drop-down that pulls from a db (Access). The fields associated with the query are task_id, task_name and task_rate. The field has the value of...
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.