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 sizbut 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.

striker73

MIS
Jun 7, 2001
376
US
I am getting the following error on my form: 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 have a combo box that pulls values from a table. I have the combo box set up so that the value you type in doesn't have to match the values in the drop-down.

Here is my code:
cboFilter1.SetFocus
cboFilter1.Text = ReportProfile.fields("cboFilter1")


The properties of my combo box are:
RowSource = "SELECT * FROM qryJobNumbers"
ColumnCount = 1
LimitToList = No

Any ideas on how to get around this?
 
Oh yeah, I don't have any code in the BeforeUpdate property or ValidationRule property of this field. The combo box is unbound, it just pulls a list of values from a table, so I don't understand why it's freaking out.
 
Striker,

(a) What is "ReportProfile" (is it the name of the form?), and
(b) In what event is the 2 lines of code being called from. You dont provide this info.

No obvious problems otherwise. If you provide more info, I'll check it out. Cheers,

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
 
Sorry about that. "ReportProfile" is a DAO recordset. It pulls a record from the ReportProfile table and then tries to display those values in combo and text boxes. The error is occuring on the line: cboFilter1.Text = ReportProfile.fields("cboFilter1"), but I even tried to just use something simple like: cboFilter1.Text = "" , but that gave me the same error message. Thanks for your help!
 
well, I have a new development on what's going on. I think it has something to do with when it's being called. I put the code in my form_load procedure and it was fine. I am calling it from cboProfileReport_AfterUpdate(), which seems to be quite a problem. I think that when you are in the after_update section of a control, you can't set the focus to another control or maybe you just can't change the value of that control. I think you might be able to do something like: txtControl = "ABC", but not txtControl.Text = "ABC". Does this make any sense?
 
I'm not sure what the real issue was, but I found an adequate work around. I just used the cboProfileReport_Change() procedure instead of the _AfterUpdate() procedure, and that seemed to work just fine. Thanks again for your help1
 
Glad you sorted it out. However, I dont think that the Change event associated with the combo box is the appropriate event. This event is fired every time you press a keystroke. Perhaps the form's OnCurrent event is more appropriate?
Good luck, Cheers,

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top