Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / August 2005

Tip: Looking for answers? Try searching our database.

Problem with referencing control on On Current event of continuous form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Strug - 04 Aug 2005 11:53 GMT
Hi,

I gather that this is quite a popular question however I'm completely unable
to find a solution through google. So if anyone can provide a helping hand
it would be greatly appreciated.

I have an Access 2003 ADP which contains a bound continuous form. Everything
(for once) is working just fine except:

Based on the contents of one control in the form I'd like to prevent the
user from editing that record depending on the contents. I.e. if txtStatus =
"Cancelled" then prevent changes to that record.

Now I understand that by using continuous forms all I should have to do is
to test the value of the txtStatus control in the current event and enable /
disable the "allowedits" property of the form as the current event will run
for every record that gets the focus.

However it won't let me get that far. Everytime I reference a control in the
continuous form in the Current event of the form, the event runs but I get
the error message:

"Run-time error '2424':

The expression you entered has a field, control, or property name that <app
name> can't find."

I'm at a loss. Can anyone explain what the application is doing and how I
can change it so that it will let me examine the status of the current
record and react accordingly. The form doesn't appear to be able to be able
to reference the txtStatus control.

The on current event contains the following code:

   Private Sub Form_Current()
       If Me!txtStatus = "Cancelled" Then
           Me.AllowEdits = False
           Me.AllowDeletions = False
       Else
           Me.AllowEdits = True
           Me.AllowDeletions = True
       End If
   End Sub

Thanks

Chris.
Ron Weiner - 04 Aug 2005 12:34 GMT
Chris

If I had to guess I would guess that the control name is not txtStatus.
Look to see if you made a Typo somewhere. Also loose the Bang operator in
Me!txtStatus and replace it with a Dot.  In fact why not leverage Access VBA
intellisense to help with this by typing Me.txt and looking to see what
Access offers as possible names of controls on your form might be.

Ron W
www.WorksRite.com

> Hi,
>
[quoted text clipped - 43 lines]
>
> Chris.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.