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

set focus - ms access

a simple one, but i'm new to access so..

I am attempting to to take a user inputted date on a form , convert it into a dayname and display iy in a another text box on the form.
I get run time error 2108, telling me to save the field and i cannot seem to find any documentation on this. thanks.


Private Sub Text15_beforeupdate(Cancel As Integer)
On Error GoTo errorhandler

Text17.SetFocus
Text17.Text = Weekday(DateValue(Text15.Text))

errorhandler:
MsgBox "Please enter a Valid date: dd/mm/yy"
Debug.Print Err.Number

End Sub
Mar 28 '07 #1
3 2612
ADezii
8,834 Expert 8TB
a simple one, but i'm new to access so..

I am attempting to to take a user inputted date on a form , convert it into a dayname and display iy in a another text box on the form.
I get run time error 2108, telling me to save the field and i cannot seem to find any documentation on this. thanks.


Private Sub Text15_beforeupdate(Cancel As Integer)
On Error GoTo errorhandler

Text17.SetFocus
Text17.Text = Weekday(DateValue(Text15.Text))

errorhandler:
MsgBox "Please enter a Valid date: dd/mm/yy"
Debug.Print Err.Number

End Sub
WeekDay will convert a Date into a Numeric value from 1 to 7 corresponding to the day of the week. If you want the actual Day Name, you could use the following code:
Expand|Select|Wrap|Line Numbers
  1. Me![Text17] = Format$(Me![Text15], "ddd") ==> returns 3 character day
  2.                           OR
  3. Me![Text17] = Format$(Me![Text15], "dddd") ==> returns complete day name
Mar 28 '07 #2
Thanks, works really well.
Mar 29 '07 #3
ADezii
8,834 Expert 8TB
Thanks, works really well.
You're welcome.
Mar 29 '07 #4

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

Similar topics

2
by: Paul Thompson | last post by:
I am trying to use various javascript tools, all of which work in NN, to work in IE. Here's my latest annoyance. I get a list of all objects on a page using docContents =...
7
by: Phl | last post by:
hi, I can use the following code to set focus to standard html elements but if I try to do the same for a custom element, it seems to complain that it does not support a focus method. Does...
20
by: Arne | last post by:
During testing <div style="overflow:auto;"> in CSS I noticed the mousewheel would work in Mozilla only after I made a <a href="#">some text</a> link and clicked on that, within the div. It...
2
by: S P Arif Sahari Wibowo | last post by:
Hi! Do you know how to put a form's Access-Visual-Basic-code that will force the form to be inserted, while the user has not type anything in the form, without changing focus, selection, etc.? ...
17
by: Neil Ginsberg | last post by:
OK, this is a stupid thing, but I can't seem to get this to work. I have a form with a subform (in continuous form view). A combo box on the main form has code in the AfterUpdate event which adds a...
1
by: Gil | last post by:
hello, im automating mappoint through access to get mileage between two address fields. when ever i call the function it makes mappoint the focus, and i have to reclick the access screen to regain...
11
by: Alex.Svetos | last post by:
Hello, I'm trying to get a popup to keep focus when it is re-clicked. The script below is supposed to produce this exact behaviour, however it doesn't work, at least on firefox 1.0.7 and moz...
0
by: jvitti | last post by:
I recently upgraded from Access 2000 to Access 2007 and I am having trouble with moving the focus from 1 form to another. While doing data entry if a similar claim is found the claim view form...
18
by: Jeff Bigham | last post by:
Hi, I'm getting an "Access is denied" error in IE when I try to focus an input box with node.focus() My understanding is that should only happen when the domains are different of the...
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
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
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,...
0
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
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
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
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
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...

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.