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

After update for date field.

I have a form with a date field and a transaction number field.


The transaction number is of the format 99678*06*10*01234. The first five digits (99678) are source code. The next two digits (06) are the register number. The next two digits (10) are the year the transaction was input. Finally the last five digits (01234) are the transaction number.

When I input the date I want the want the cursor to go to the transaction number field with the source code, register number and the year already input, rest in the 10th place.


I.e., if the input date is 24-June-10, the string 99678*06*10* should be input and the cursor should be resting in the 10th position. How do it do it?


I tried this.

Expand|Select|Wrap|Line Numbers
  1. Private Sub inputDate_AfterUpdate()
  2. transNo.Value = "99678*06* &CInt(Format(inputDate(),'yy'))"
  3. End Sub
  4.  
Thanks
Apr 28 '11 #1
2 2013
colintis
255 100+
A correction to your current code first, you should place the closing double quote before the & CInt(...). Otherwise you will be seeing this code as part of your result as well. By including the cursor positioning code, it should be like this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub inputDate_AfterUpdate() 
  2.  
  3. transNo.Value = "99678*06*" & CInt(Format(inputDate(),'yy')) 
  4.  
  5. transNo.SelStart = 10
  6. transNo.SelLength = 0
  7.  
  8. End Sub 
  9.  
The .SelStart is basically what you were requesting, while .SelLength specifies or determines the number of characters selected in a text box.

An additional reminder, if your cursor is placing after the 3rd set of digits, then the .SelStart should be 12.
Apr 29 '11 #2
Thanks.

It is working beautifully.

Cheers
Apr 29 '11 #3

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

Similar topics

4
by: fwiest | last post by:
Could someone help me with the most efficient way to update a date field. I have a field with Date and Time in it but I want to update it with only the Date and strip off the time. Any ideas for...
1
by: rkbnair | last post by:
In order to update the date properly, should I add anything before and after the variable dte_send_again? str_update_command = "UPDATE web_tbl_emails SET dte_resend= " + dte_send_again +",...
3
by: BlackFireNova | last post by:
This concerns an Access 2002 (XP) database. There are two fields, "Notes" (Memo Field) and "Notes Update" on a form (among others) which I am concerned with here. Problem: I need to be able...
3
by: David | last post by:
Hi I use a calendar to update a field and the after update event no longer works, if i manually update it there is not a problem. How can I get this event to trigger Thanks in advance Dave
1
by: kunal0101 | last post by:
Hi, I am a new user to access and am building a database to capture the rotation dates for employees. There is a table called "Rotation schedule" which contains "name", "Duration (in weeks) and...
1
by: gchris53 | last post by:
Hello, Any advice on the attached would be greatly appreciated. I am currently customising someone elses database and have the following problem. A date is updated on a form, in database...
0
by: Sambhav | last post by:
Hi I am using MS sql right now I m felling up the data into the database using a software called DTM data generator so my problem is I have filled all the dates in 4 different columnsin a single...
4
by: EOHS | last post by:
I use Access 2002. I created a form that updates when a patient gets a Flu Vaccine. I would like to simply check a checkbox and the form should take todays date and store it in the field FLUDATE...
4
by: Dr Al | last post by:
I have a project which requires the batch import of customer contact information, print mailing labels for those customers who have their date of first letter field in the database set to null, and...
4
by: bluemoon9 | last post by:
I would like to make my "MODDATE" field to be updated to the current date when user edit record by "Click on Save" button Here is my code for the "Save" button: Private sub Save Click() MsgBox...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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
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
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
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.