Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Old 04-07-2008, 09:27 AM   #1
SeaRox
Registered User
 
Join Date: Apr 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
SeaRox is on a distinguished road
run time error 2107

I get the subject run time error when I try to past a record. The error reads:

"The value you entered doesn't meet the validation rule defined for the field or control."

Then it takes me here in the VBA:

Private Sub cboEmployee_AfterUpdate()
Me.RecordSource = "qryHours"
Me.Refresh
End Sub

More info:
The form I am using is a continuous form. The record source for the form is "qryHours". The combo box "cboEmployee" is a drop down they use to select their name, which updates the form with the hours they have logged into the system.

Because the projects they work on are the same from week to week they would like to copy and past records, making keeping track of their time less time intensive.

Any ideas?

SeaRox is offline   Reply With Quote
Old 04-07-2008, 09:57 AM   #2
SeaRox
Registered User
 
Join Date: Apr 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
SeaRox is on a distinguished road
I think it has something to do with how everything is linked. (or not linked) because when I create a new record it doesn't get linked to the employee.
SeaRox is offline   Reply With Quote
Old 04-07-2008, 10:02 AM   #3
boblarson
Smeghead
 
boblarson's Avatar
 
Join Date: Jan 2001
Location: Oregon, USA
Posts: 32,068
Thanks: 97
Thanked 1,803 Times in 1,573 Posts
boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold
Why are you trying to set the form's recordsource each time the combo is used. You shouldn't be doing that. Just requery the form (not REFRESH)

Me.Requery

__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
boblarson is offline   Reply With Quote
Old 04-07-2008, 10:08 AM   #4
SeaRox
Registered User
 
Join Date: Apr 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
SeaRox is on a distinguished road
I was able to fix the linking issue and I changed the code to this:

Private Sub cboEmployee_AfterUpdate()
Me.Requery
End Sub

but it gives me a new error when I try to copy and paste records (below). I found that the paste works if I just hit [end], but I don't want the VBA code popping up everytime they try to copy and paste their hours.

New error:
"Run time error 3314
The field 'Hours.JON' cannot contain a Null value because the Required property for this field is set to True. Enter a value in this field."

The record I am copying has a Job Order Number in it so I'm not sure why it is giving me this new error.

Last edited by SeaRox; 04-07-2008 at 10:21 AM. Reason: Correction
SeaRox is offline   Reply With Quote
Old 04-07-2008, 10:49 AM   #5
Rabbie
Super Moderator
 
Rabbie's Avatar
 
Join Date: Jul 2007
Location: Returning to Scotland
Posts: 5,906
Thanks: 110
Thanked 75 Times in 67 Posts
Rabbie is a jewel in the rough Rabbie is a jewel in the rough Rabbie is a jewel in the rough
The Error message suggests that you are creating a new record without a valid value in the Hours.JON field. It would seem that you have set the Required property for this field so it errors if it is not set.
__________________
The best solution is the simplest one that meets all requirements.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Rabbie is offline   Reply With Quote
Old 04-07-2008, 10:54 AM   #6
SeaRox
Registered User
 
Join Date: Apr 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
SeaRox is on a distinguished road
Rabbie,

That is true. The record I am copying has a valid value in that field. So why when I copy that record is it telling me that it is not valid?

I tried removing all the required fields and it gives me another error. I didn't copy the exact wording but it says that the records that couldn't be copied have been sent to a new table "Past Errors." This goes back to my linking issue. The records in the "Past Errors" table contain all the information except the employees name from the record I copied.

Does this help?
SeaRox is offline   Reply With Quote
Old 04-07-2008, 11:01 AM   #7
boblarson
Smeghead
 
boblarson's Avatar
 
Join Date: Jan 2001
Location: Oregon, USA
Posts: 32,068
Thanks: 97
Thanked 1,803 Times in 1,573 Posts
boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold
The new record isn't getting the new primary key inserted before it tries to paste the other information and it probably needs that first.

Can you post the db?

See here for how:

http://www.access-programmers.co.uk/...d.php?t=140587

__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by boblarson; 04-07-2008 at 11:04 AM. Reason: revised information
boblarson is offline   Reply With Quote
Old 04-07-2008, 11:10 AM   #8
Rabbie
Super Moderator
 
Rabbie's Avatar
 
Join Date: Jul 2007
Location: Returning to Scotland
Posts: 5,906
Thanks: 110
Thanked 75 Times in 67 Posts
Rabbie is a jewel in the rough Rabbie is a jewel in the rough Rabbie is a jewel in the rough
Can you post a cutdown copy of your DB so we can see better what is going on
__________________
The best solution is the simplest one that meets all requirements.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Rabbie is offline   Reply With Quote
Old 04-07-2008, 12:15 PM   #9
SeaRox
Registered User
 
Join Date: Apr 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
SeaRox is on a distinguished road
Working on reducing the file size to post.
SeaRox is offline   Reply With Quote
Old 04-07-2008, 01:16 PM   #10
SeaRox
Registered User
 
Join Date: Apr 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
SeaRox is on a distinguished road
DB uploaded

I have pared it down so the file is small enough to upload. It opens to the form I am working on. To view an employees hours click on the drop down arrow (combo box) in the upper right hand corner.

I want to be able to copy and paste (or use the copy button) and just change the date as much of the work is repetative.

While you are looking at the file if you know a way I can limit the sum in the footer to the current week that would be very helpful also. (txtWeekHours) txtWeek selects the week I want to sum the hours for.

Thanks for your help.
Attached Files
File Type: zip LaborUsage_2008-04-07.zip (135.7 KB, 145 views)
SeaRox is offline   Reply With Quote
Old 04-10-2008, 06:35 AM   #11
SeaRox
Registered User
 
Join Date: Apr 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
SeaRox is on a distinguished road
boblarson,

I put in the command you suggested. The errors have ceased, but it still does't link the record being copied to the employee. I tried changing the Control Source and the Row Source around and I got it to link to the employee but then it didn't copy any of the information from the record I was trying to copy.

SeaRox is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Run time error '13' Type mismatch alant37 Modules & VBA 1 06-22-2005 06:32 AM
Run Time Error - No Value Given RichardH Modules & VBA 3 06-16-2005 04:17 AM
Run Time Error 2001 - What am I doing wrong? zeee Reports 0 01-06-2005 07:52 AM
Run Time Error after refreshing the form zeee Forms 0 01-06-2005 07:12 AM
Out of Memory - Run time error 7 linda sciallo Reports 0 11-15-2001 07:31 AM




All times are GMT -8. The time now is 01:00 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World