run time error 2107 (1 Viewer)

SeaRox

Registered User.
Local time
Today, 02:56
Joined
Apr 1, 2008
Messages
29
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

Registered User.
Local time
Today, 02:56
Joined
Apr 1, 2008
Messages
29
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.
 

boblarson

Smeghead
Local time
Yesterday, 23:56
Joined
Jan 12, 2001
Messages
32,059
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
 

SeaRox

Registered User.
Local time
Today, 02:56
Joined
Apr 1, 2008
Messages
29
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:

Rabbie

Super Moderator
Local time
Today, 06:56
Joined
Jul 10, 2007
Messages
5,906
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.
 

SeaRox

Registered User.
Local time
Today, 02:56
Joined
Apr 1, 2008
Messages
29
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?
 

Rabbie

Super Moderator
Local time
Today, 06:56
Joined
Jul 10, 2007
Messages
5,906
Can you post a cutdown copy of your DB so we can see better what is going on
 

SeaRox

Registered User.
Local time
Today, 02:56
Joined
Apr 1, 2008
Messages
29
Working on reducing the file size to post.
 

SeaRox

Registered User.
Local time
Today, 02:56
Joined
Apr 1, 2008
Messages
29
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.
 

Attachments

  • LaborUsage_2008-04-07.zip
    135.7 KB · Views: 212

SeaRox

Registered User.
Local time
Today, 02:56
Joined
Apr 1, 2008
Messages
29
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.
 

Users who are viewing this thread

Top Bottom