473,756 Members | 3,663 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Duplicate events on access form (access 2003)

38 New Member
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 2146
NeoPa
32,572 Recognized Expert Moderator MVP
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 New Member
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,572 Recognized Expert Moderator MVP
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 New Member
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_du e" and it's in the sub continuous form of the receipt (called "sub_receip t).
Thanks
Aug 29 '09 #5
NeoPa
32,572 Recognized Expert Moderator MVP
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 New Member
Thanks, I think I have a problem with the date format either in the "payment_type"c ontrol 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
FishVal
2,653 Recognized Expert Specialist
Problem with DateAdd and Default Value
Aug 30 '09 #8
eyalco
38 New Member
Thanks, That's great - exactly my problem.
Thanks.
Aug 31 '09 #9
NeoPa
32,572 Recognized Expert Moderator MVP
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

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

Similar topics

9
3112
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 in MyForm1 is processed? Is there ever an exception that might create
3
28843
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 make one or two changes to the new one. This is the problem I have with Access. Look at this answer! >Private Sub btnCopy_Click() >On Error GoTo handle_error > Set cnxn = CurrentProject.Connection > Set rs = New ADODB.Recordset
3
4177
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 - mydb1.mdb. And if I try opening mydb1, then mydb11.mdb is created. Anyone have any idea why this is happening? How I can stop this? Thanks in advance.
8
3946
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 this line: Set rs = db.OpenRecordset("SELECT ID FROM Contacts WHERE (" & sWhere & ");") Contacts being the main table. I am using access 2003 The error message states that there are; Too few parameters. Expected 1 I have no idea how to...
9
11232
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 Size is set to "Long Integer", and New Values is set to "Increment".) I know that an old version of the Jet database engine can cause this problem, but my version of msjet40.dll is 4.0.8618.0, which is supposedly bug-free in this respect. I am...
12
2137
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 acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70 DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
1
3154
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 called OrderID. It is linked to a (sub)table called Parts (primary key: PartID: autonumber) and this one is linked to a (sub sub) table called SubParts (primary key: SubPartID: autonumber). The idea is that a Order can be filed for multiple parts and...
2
1871
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 bound form called frmViewContracts where i view all my contracts on the system.This form is from query called qryViewContracts.
5
1282
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 procedure for every button?
0
9456
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9273
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9872
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8712
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7244
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.