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

Duplicate events on access form (access 2003)

38
I have a receipt form (with continuous sub-form) where I need to issue many receipts in 1 form (from 12 to 36).
I need to duplicate the details of each receipt (the only change every time is the date and the cheque number).
For the duplication i'm using :
Expand|Select|Wrap|Line Numbers
  1. Me.dup_field.DefaultValue = """" & Me.dup_field & """"
for the cheque number i'm using :
Expand|Select|Wrap|Line Numbers
  1. Me.CHECK_NO.DefaultValue = """" & Me.CHECK_NO + 1 & """"
My problem is the date : each cheque is for the following month - how do I use the dateadd function along with my code to aachieve what I need please?
Aug 29 '09 #1
11 2123
NeoPa
32,556 Expert Mod 16PB
In which of the forms are the controls :
Me.dup_field
Me.CHECK_NO

"the following month" refers to the month following which? The current month, or the month associated with the previous record?

What and where is the control that holds your month date?
Aug 29 '09 #2
eyalco
38
dup_field (which is the date).
The following refers to the first month I write: 1st cheque I write and then I wamt the following cheque to be written (cheque are givven in a 1 month interval so if I write 01/09/09 the next will be 01/10/09).
Thanks.
Aug 29 '09 #3
NeoPa
32,556 Expert Mod 16PB
I'm not sure whether that answers any of the 4 questions posted.

Please try to answer each of the questions so I can try to help.
Aug 29 '09 #4
eyalco
38
The controls are in the sub-form (continuous).

the following month" refers to the month following which? The current month, or the month associated with the previous record?
The month associated with the previous - It's on 1 month intervals of the 1st date entered.
example : If cheque is due on the 15/09/09, then I should get automatically the in next line - 15/10/09.

The control that holds my month date is called "payment_due" and it's in the sub continuous form of the receipt (called "sub_receipt).
Thanks
Aug 29 '09 #5
NeoPa
32,556 Expert Mod 16PB
I'm not sure where you're putting the code (listed in the Original Post), but if it's working that's great.

The first line should be straightforward enough as the value never changes. Furthermore, using the .Default property is certainly the best way to do this.

If you have the second line shown in a place where it works correctly (possibly the After_Update of the control itself), then that's also good thinking and should work (You probably already know that it does).

Getting onto the date issue then, now I realise this is simply a date manipulation issue and you already have the most complicated issues covered :
In code similar to what you are already using for your Cheque Number control :
Expand|Select|Wrap|Line Numbers
  1. Me.Payment_Due.DefaultValue = Format(DateAdd("m", 1, Me.Payment_Due), "d mmm yyyy")
It is important to check that the current entered value is a valid date however.

PS. Your date format can be anything that suits you. I've used an internationally independent version here.
Aug 30 '09 #6
eyalco
38
Thanks, I think I have a problem with the date format either in the "payment_type"control or with my access/computer.
When I type 01/09/09 the next date I get (in the next line) is 30/12/1899 instead of 01/10/09 and it stays that way on the next rows.
The date format on the control is short date.
Thanks.
Aug 30 '09 #7
eyalco
38
Thanks, That's great - exactly my problem.
Thanks.
Aug 31 '09 #9
NeoPa
32,556 Expert Mod 16PB
My bad.

Of course the .Default value would be clearer with the "#" characters around it. That is to say they can work without (in some circumstances only) yet they should always work with. I should have used them, unquestionably.

I would also add that using any format of date that could be ambiguous (dd/mm/yy and mm/dd/yy ARE ambiguous) is open to problems. Three character months are useful for clarity I find.
Aug 31 '09 #10
eyalco
38
I appreciate your comments.
In light of that, can you write what's your take on the best solution now?
Thanks.
Aug 31 '09 #11
NeoPa
32,556 Expert Mod 16PB
I would need to understand exactly what the requirements are. Can you use a format like "d mmm yyyy"? That would be my recommendation if you could as it's pretty unambiguous.

When assigning the resultant, formatted string to the .Default property make sure to surround this, within the string, in hashes (#).

I hope this answers your question. It seems a bit like simple repetition of what's gone before, but if not then I'm not sure what you require.
Aug 31 '09 #12

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

Similar topics

9
by: MLH | last post by:
If you have these lines in code on MyForm1... DoCmd OpenForm "MyForm2`" MsgBox "I opened MyForm2" Is it #ALWAYS# true that all form events on MyForm2 will occur before the MsgBox statement...
3
by: Nhmiller | last post by:
I searched here for an answer. I am entering records into a database, and it would save a lot of time if I could duplicate a record that is very similar to the new one I am about to enter, then...
3
by: deko | last post by:
I'm using Access 2003 on WinXP-SP2. I open mydb.mdb from Windows Explorer, or from a shortcut that points to the mdb. The problem is every time I open mydb.mdb, a duplicate is created -...
8
by: Iona | last post by:
Hi Allan, I'm using a nifty piece of code you put on here some time back to do a duplicate entry check as below. I'm using to check for duplicate names. However I am getting an error message on...
9
by: Tom_F | last post by:
To comp.databases.ms-access -- I just discovered, to my more than mild dismay, that some tables in my Microsoft Access 2003 database have duplicate numbers in the "AutoNumber" field. (Field...
12
by: capdownlondon | last post by:
Working in Access 2003. I have managed to duplicate a record using a button on a form with code: Private Sub Command16_Click() On Error GoTo Err_Command16_Click DoCmd.DoMenuItem...
1
by: bemadragon | last post by:
Hello, I have been struggling with this for a while. I am working on a rather simple database for calculation purposes in Access 2003. I have a table called Order that has a primary key field...
2
by: fabiola1 | last post by:
I'm using Ms Access 2003. I have five tables called tblAllContract tblType tbInteranlContact tblSupplier tblManager The other four tables are linked to tblAllContracts with Id's.I have a...
5
by: brucedodds | last post by:
I would like a particular action to fire every time there's a mouseover event for any button on my (Access 2003) form. Does anyone know how to do this without writing an OnMouseOver event...
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
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
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...
0
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,...
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.