Solved

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

Posted on 2006-10-19
2
1,166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

733 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