Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 2115???

Status
Not open for further replies.

a75537

Programmer
Feb 26, 2003
25
CA
I'm trying to do something really simple and I keep getting an error.

I have a form with two combo boxes and a text box. The first combo box contains Review Types and the second combo box contains Review Sections based on the review type selected in the first combo box. I want the text box to display the placement of the Review Section based on the selection of the Review Sections combo box.

The first combo box uses a query that contains the ReviewIndex and ReveiwType from a table called Review. The ColumnCount is set to 2, and the ColumnWidths are 0";1". The BoundColumn is 1.

The second combo box uses a query that contains the ReviewSectionIndex, SectionTitle, Placement and ReviewIndex(the criteria for ReviewIndex is set to equal the Review Types combo box value) from a ReviewSection table. The ColumnCount is set to 3, and the ColumnWidths are 0";1";0". The BoundColumn is 1.

I'm trying to set the value of the Placement text box to the value for the 3rd column of the Review Section combo box. I don't want it displayed as another column in the combo box because the user needs to be able to change these numbers.

Here is my code in the AfterUpdate event of the first combo box:

Private Sub cboReviewType_AfterUpdate()
Me.cboReviewSection.Requery
Me.cboReviewSection.SetFocus
Me.cboReviewSection = Me.cboReviewSection.ItemData(0)
Me.txtPlacement.SetFocus
Me.txtPlacement.Text = Me.cboReviewSection.Column(2)
End Sub

Here is my code in the AfterUpdate event of the second combo box:

Private Sub cboReviewSection_AfterUpdate()
Me.txtPlacement.SetFocus
Me.txtPlacement.Text = Me.cboReviewSection.Column(2)
End Sub

Now, this is the problem: Whenever I try to update the text in the txtPlacement textbox (underlined above), I receive this message: 'Run time error 2115: The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Microsoft Access from saving the data in the field'.

I do not have anything in the BeforeUpdate event or for the ValidationRule property. Also, if I change the text box to a label and use the label's caption property to display the text it works fine. However, I need to figure out some way to use the text box so the user will be able to change the value.

Any idea??

Thanks.


 
I've figured out a work around, but still don't understand this error.

I put a 'dummy' label on the form and changed the caption to the value that I want for the text box(Me.cboReviewSection.Column(2)). I then set focus to the text box and change the text box text value to the caption of the 'dummy' label. This gives me the result I want without any errors.

I would still like to know why I was receiving the preceeding error though if anyone has thoughts.

I forgot to mention that I'm using Access '97.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top