Date Update and

I have the following very simple code in a BeforeUpdate Event
Procedure

Private Sub Date1_BeforeUpdate(Cancel As Integer)
  Me!Date1 = Date
End Sub

I just want it to put the date in the field when someone changes the
data in the form.
However when I run it I get the following error. ( and no date
inserted into the field)

Run-time Error '2115'
The macro or function set to the BeforeUpdate or ValidationRule
property for this field is preventing the Employee Database v1 from
saving the data in the field.

I have searched for an answer to this and it seems people say that its
due to to the field being set in the table to "Allow Zero Length" No
But I have simply used the default settings that access sets up which
is Yes. The field is a text field but when I set it up to date field
it doesnt help. Can anyone point me to what I dont understand about
this.

Thanks.

0
steve
5/9/2007 6:24:16 PM
access 16762 articles. 3 followers. Follow

3 Replies
797 Views

Similar Articles

[PageSpeed] 16

steve wrote:
> I have the following very simple code in a BeforeUpdate Event
> Procedure
>
> Private Sub Date1_BeforeUpdate(Cancel As Integer)
>  Me!Date1 = Date
> End Sub
>
> I just want it to put the date in the field when someone changes the
> data in the form.
> However when I run it I get the following error. ( and no date
> inserted into the field)
>
> Run-time Error '2115'
> The macro or function set to the BeforeUpdate or ValidationRule
> property for this field is preventing the Employee Database v1 from
> saving the data in the field.
>
> I have searched for an answer to this and it seems people say that its
> due to to the field being set in the table to "Allow Zero Length" No
> But I have simply used the default settings that access sets up which
> is Yes. The field is a text field but when I set it up to date field
> it doesnt help. Can anyone point me to what I dont understand about
> this.
>
> Thanks.

Use BeforeUpdate of the FORM, not the control you want to update.

-- 
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com 


0
Rick
5/9/2007 6:29:49 PM
Ohhhhhhhh ....

That Works,

So why would it not work on that local field it "seems" like it
should, Why is this ??

Thanks.

0
steve
5/9/2007 7:25:07 PM
steve wrote:
> Ohhhhhhhh ....
>
> That Works,
>
> So why would it not work on that local field it "seems" like it
> should, Why is this ??
>
> Thanks.

In the BeforeUpdate event of a control you are trying to set the value of 
that very same control.  You don't see a problem with that logic?

Even if it worked the user is never going to update that control since you 
want that to happen automatically anyway so the BeforeUpdate of the control 
should never fire in the first place.

-- 
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com


0
Rick
5/9/2007 8:02:40 PM
Reply:

Similar Artilces:

system date returns null
Testing for the year returns a null using the system date. I am using Access2007. This worked in Access2003. My code is: 190 If Right(Year(Date), 2) = txtEYear Then txtEYear = "" When I run the code and check "date" with debug, it shows 'null'. On Sun, 14 Feb 2010 14:21:02 -0800, Dave <Dave@discussions.microsoft.com> wrote: That's unusual. Does your code compile? Check a code window > Debug > Compile. -Tom. Microsoft Access MVP >Testing for the year returns a null using the system date. I am using &...

How To Update Enhanced USB Drivers WITHOUT Freezing/Locking Up Sys
Hello: I have been encountering this annoying problem and I would appreciate anyone's help in working around it. I have been building and updating several systems, including updating system bios, chipsets, etc. Whenever I update an enhanced USB controller driver (as part of an Intel-based chipset), if the system is using a USB-based keyboard or USB-based mouse, those specific devices freeze up/stop running. Unless the system is using a PS-2-based keyboard or a PS-2-based mouse, I have to do a "hard" shutdown, to restart the system and get the newer enhanced U...

Update Query basic
I have Table1 with field Track, I want to update with info from field Track in Table2 add both tables to design view field track but don't know what to put in update too. Am missing something here - hope you can help. Want to eventually use this to update adress fields from one table to another with EmpID connecting each. UPDATE table2 INNER JOIN table1 ON table2.ItemID= table1.itemID SET table2.UnitPrice = table1.UnitPrice would update the unit price of table2 with the unit price coming from table1, for the same itemID (ie, the APPLE unit price won't be updated by the ORANGE ...

Stock Price Update
This is a multi-part message in MIME format. ------=_NextPart_000_0048_01C394C8.DA1D9E10 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Hi, Is there any way to get stock price (China market) updated in Money 2003 = via MSN's service? If the service is not available with MSN, can Money = 2003 be set to connect the third party service provider to online-update = China market's stock price, and anyone know these providers? if any. Thanks. ------=_NextPart_000_0048_01C394C8.DA1D9E10 Content-Type: text/html; charset="gb2312" ...

Format a Date Using Field Properties
I know how to do this in Visual Basic and Assembler but having trouble with the Syntax in Access On the Format Event on the Properties Menu for a Field I have ("mm/d/yy") I have been guessing and trying to find an example on the WEB and in Access Help and still cannot determine what I am doing wrong. All I want to do is display the year as two characters instead of four! On my Format Tab, On the Format Line (The first line) What Syntax does it want to do this very simple task! Thanks in Advance Len mm/d/yy (no quotes) -- Doug Steele, Microsoft Access MVP http://I.Am/Do...

Convert Date Format
I receive data with the date format as "20051106" [6 Nov 2005] which is OK for me but end users want to see it in the more conventional "dd/mm/yyyy" format. How can I transpose the data and insert separators. Tks Mike You could use a formula such as =RIGHT(E20,2)&"/"&MID(E20,5,2)&"/"&MID(E20,3,2) assuming your data was in cell E20 HTH -- _______________________ Naz, London "Mike" wrote: > I receive data with the date format as "20051106" [6 Nov 2005] which is OK > for me but end users want to see ...

Auto enter date?
Hi! me again! is there any way i can get excel to auto enter dates that jump by 7 days every 7th cell along? cheers steve Ive worked part of this out. in cell G1 =DATE(105,1,3) in cell M1 =G1+(WEEKDAY(G1)>=1)*7-WEEKDAY(G1)+1 but its displaying the time...i just want the date.... steve "R.P.McMurphy" <rpmcmurphy@ntlworld.com> wrote in message news:43118dff$0$17506$ed2e19e4@ptn-nntp-reader04.plus.net... > Hi! me again! > > is there any way i can get excel to auto enter dates that jump by 7 days > every 7th cell along? > > cheers > > s...

FWD: Apply this security update from the Microsoft
--bketekedpvwgb Content-Type: multipart/related; boundary="sgpblhrz"; type="multipart/alternative" --sgpblhrz Content-Type: multipart/alternative; boundary="rxwxrevoeqtb" --rxwxrevoeqtb Content-Type: text/plain Content-Transfer-Encoding: quoted-printable MS Customer this is the latest version of security update, the "October 2003, Cumulative Patch" update which eliminates all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three newly discovered vulnerabilities. Install now to help protect ...

Updating Sales Order total
Greetings All: I'm integrating UPS shipping system with GP 9.0. I have developed an application that writes the freight and tracking data back to an order. I write the freight total to SOP10100.FRTAMNT. I'm quite green with GP 9.0 and discovered that indeed the freight on the order is updated but the order total doesn't get updated. What's the best way to get the order's bottom line updated? Is there some stored procedure or something that handles this logic? Thanks in advance, -Rusty Hi, I have tested you scenario as stated by you, the choice is yours if you ...

Dates 06-18-07
My problem: I am trying to have one date minus another date. I want to display the difference in days. Help! -- TeeDEe Hi DateDiff("d", [StartDate], [EndDate]) HTH -- Wayne Manchester, England. "TeeDee" wrote: > My problem: I am trying to have one date minus another date. I want to > display the difference in days. Help! > -- > TeeDEe ...

Money not updating online
It seems that Money goes to www.spcomstock.com to get quote updates (look in my information sheet) ... however that site has change to www.comstock- interactivedata.com. Now online updating in Money doesn't work ... at least mine doesn't. Try to go to the www.spcomstock.com and you'll time out with an error. I don't see any way to change how money accesses the web site. Thoughts .... am I off base. Have read other notes on the subject and suggestions around firewalls etc. I haven't changed mine, but just in case turned it off and still money won't update....

Updating Test company database
I have used the techknowlege procedure for setting up a new test company. But once the test company's set up, after a while the data gets old. To refresh the test database with current Live info I'll do the backup "Live" and restore to "Test". Do I still need to run the scripts described in the TK or is that only necessary the first time? Thanks, DavidF. David, You need to run the scripts every time you do a restore. Frank Hamelly MCP-GP, MCT East Coast Dynamics www.eastcoast-dynamics.com ...

How to update Contact lookups in CRM 4.0
How can I use CRM 4.0 Import to update the lookups of existing Contact records? The lookups to be updated are stored in a .CSV file with the corresponding contactid of the Contact record. I read from the CRM Help file that there is a "enrich data by updating records rather than creating new records" facility but I wasn't able to make this checkbox appear. I tried to do it but keep encountering this error message, "A SQL Server error occurred. Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organ...

Date format in header/footer..
Is there a way of editing the format in the header / footer? I am running Office 2000 on a 933MHz P3 with Win98SE and 512MB RAM. TIA, -GHB Hi AFAIK only possible with VBA -- Regards Frank Kabel Frankfurt, Germany "Sonja" <burmapb@hotmail.com> schrieb im Newsbeitrag news:C9sUc.268963$a24.58397@attbi_s03... > Is there a way of editing the format in the header / footer? I am > running Office 2000 on a 933MHz P3 with Win98SE and 512MB RAM. > > TIA, > -GHB > You can use a macro: Put this in your workbook's ThisWorkbook code module (if you're unf...

COUNTING DATES #4
How do i write a formula to count the number of lines on a database of information that have a date that matches todays date? Say I have a huge database with 10,000 lines of info and I want it to look at all the info and put a number in a cell that says how many of the lines in the datbase contain todays date. -- na See COUNTIF Worksheet Function in help --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "Cody" &l...

What is the easiest way of bulk updating Account information?
Hi, What is the easiest way of updating all the Accounts where the Account ID ends in "C" with a Relationship Type of "Customer"? TIA Hi GP, The easiest way i know is going through the advanced find. Use advanced find to select all the accounts that meet those requirements, then check the box to highlight all records. Go to the toolbar and select "more actions" then select edit. It will bring the account form up and you can make the mass edits there. Hope this will help Jarrett http://www.dynamics4.com On Jan 15, 11:39=A0am, GP <G...@discussions.micros...

Conditional formatting of date
I want to compare a date in a cell to the current date. If the current date is past the date in the specified cell, and the adjacent cell is blank, I want the specified date to display in red. Would someone be so kind as to assist me with this please. You need conditional formatting. Select the cell to format, and let's assume that the compare cell is A1 Menu Format>Conditional Formatting Change Condition1 to Formula Is Add a formula of =AND(A1<TODAY(),B1="") Click Format Choose the text colour OK OK -- HTH Bob Phillips "cebubum" <cebubum@discussio...

Automatic fill a static date? #2
Thx, working on it... -- Luck ----------------------------------------------------------------------- Lucky's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1487 View this thread: http://www.excelforum.com/showthread.php?threadid=26501 ...

Update Resource Availability
I have configured Project Gateway in Portfoilio Server. I am now trying to sync Resource Availability and get the following error. I can't work out where to change this custom field. Can anyone help? Could not update availability for server 'EUPROJECT'. Invalid resource custom field specified for requirement synchronization. The Resource Custom Field mentioned is the field "Resource Type Custom Field" configured in the Project Server Definition under Project Server Gateway in PPS. That field name must match with your associated field in Project Server...

Excel suddenly converts dates to serial numbers
I set up my excel 2003 for dates to be written 4/25/2004 and instead all I get is serial numbers. I tried to format the cell for the date as above but it only comes out in serial numbers. When I set this spead sheet up it worked fine. The suddenly this changed and the dates went away. I cannot reverse this. any hints. Maybe you hit Ctrl-~ by accident and changed to "formulas view"? Hit it again or uncheck Tools, Options, View, Formulas. -- Jim Rech Excel MVP "scheinz@cox.net" <anonymous@discussions.microsoft.com> wrote in message news:6c1e01c42ee8$a77...

Problem with access date
Hello, I have seen a very strange problem with Excel 2007 : When a user opens an excel file and closes it immediately, the Excel file is modified (the CRC is changed), but the archive attribute is not set and the last modification date is not set too. Is there a way to solve this problem? Thank you Marc I'm fairly sure the last modification date is only set if you save after a change. -- Regards Dave Hawley www.ozgrid.com "Marc Allard" <marc@allcomp.be> wrote in message news:1BD63248-318F-4EED-88F6-BE026C62F4EB@microsoft.com... > Hell...

Dates from Worksheet won't appear in Category Axis
I know I have just drawn a blank but I am getting no where with my memory Just doing a simple column chart with dates and dollar amounts. My Y axis is fine by I am not getting my actual worksheet dates shown on the charts X asis. What in the heck have I done....please Sue K Never mind, I just got my memory back Thank you. ...

Trendline Update
I'm using Excel 2000 (9.0.2720). I have a simple chart with a trendline added. After I enter new data, does the trendline equation automatically update, or do I have to perform an operation to get it to update? Thanks! Bill Try it and see... I think you will find that it does update. You can also create the formual yourself using the slope and intercept functions... -- HTH... Jim Thomlinson "Bill" wrote: > I'm using Excel 2000 (9.0.2720). I have a simple chart with a > trendline added. After I enter new data, does the trendline equation > au...

excel 2007 Charts don't update
As new data is input the chart remains the same and doesn't reflect new data. The data values and number of entries can be completely different. I think there is a setting somewhere to automate the chart update but I can't find it. Thanks Steve If you're adding data below the range pointed to by the chart, then the chart won't update. If you put the source data in an Excel Table, then the chart will update. Otherwise, you're going to have to click on the chart & drag the range indicators down to increase the # of rows used. "Steve" wrote: ...

windows update error message 03-03-10
Hi For the last week or so I've been getting the message "The website has encountered a problem and cannot display the page you are trying to view. The options provided below might help you solve the problem. " I have 4 computers on a router using the firewall in the router, no other firewalls running and using AVG version 9.0 for all 4 PCs, which are all running XP SP3. The message is displayed from all the computers. Nothing was changed-- no settings on the firewall or on the PCs. Thanks! You receive a "Windows Update has encountered an error and ca...