Solved

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

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
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…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

919 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

17 Experts available now in Live!

Get 1:1 Help Now