Solved

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

Posted on 2006-10-19
2
1,162 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

839 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