Solved

Runtime error 2101.  The setting you entered isn't valid for this property

Posted on 2006-10-19
2
1,148 Views
Last Modified: 2008-03-17
Hi,

I have Mousedown event (on an option button) where it
1) calls a dialog form (to load a fire)
2) waits for the form to be closed (via Do Events)
3) and then depending if the user did load a file or canceled, enable/disable all option buttons (including this one)

However, i receive runtime 2101 when it executes the 1st line after the else statement below:
Me!opbFileLoad.Enabled = False

Effectively, since the file was loaded, I do not need to enable the "Load File" option button anymore (opbFileLoad).

Any ideas?


Private Sub opbFileLoad_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
   '1. Open Dialog box to load file
   DoCmd.OpenForm "SelectFile", , , , , , _
   "Load,Application Journal,FileAttachment,Application Journal,ApplicationJournalId," & Me![txtApplicationJournalId] & _
   ",FileName,Job Application Journal"
   '0 = Action, 1 = Form, 2 = Target field, 3 = Table, 4 = Search field, 5 = Search value
   '6 = Table FileName field, 7 = Optional Mainform (for triggering save records
   '                                                 prior to loading)
   While SysCmd(acSysCmdGetObjectState, acForm, "SelectFile") <> 0
      DoEvents
   Wend
   
   'Update option button choices depending on result from above (eg. if user selected
   'a file or not
   If IsNull(Me![FileName]) Then 'No file was chosen
      Me!opbFileLoad.Enabled = True
      Me!opbFileViewEdit.Enabled = False
      Me!opbFileDelete.Enabled = False
   Else 'File was chosen
      Me!opbFileLoad.Enabled = False
      Me!opbFileViewEdit.Enabled = True
      Me!opbFileDelete.Enabled = True
   End If
End Sub
0
Comment
Question by:ngekas
2 Comments
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 17763942
Although the error isn't referring to as much - you can't disable a control that has the focus on a form.
0
 
LVL 39

Accepted Solution

by:
stevbe earned 125 total points
ID: 17765230
so to go along with what LPurvis posted ... add a SetFocus to a control that is enabled before disabling the FileLoad control ...

   Else 'File was chosen
      Me!opbFileViewEdit.Enabled = True
      Me!opbFileViewEdit.SetFocus
      Me!opbFileDelete.Enabled = True
      Me!opbFileLoad.Enabled = False
   End If
End Sub

Steve
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now