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 / Modules / DAO / VBA / May 2006

Tip: Looking for answers? Try searching our database.

refreshing a field on a form using VB or protecting a field from u

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Karen_at_UniGroup - 24 May 2006 20:09 GMT
I'm trying to add logic to my VB code to not allow changing of a field (for
example, an existing order number).   I added logic in VB code of the Before
Update event, that if something exists in that field already, the VB code
displays a message saying it can't be changed, and I saved the original value
of what was in their before they edited it, but I can't figure out how to put
that original value back in.    Only on new orders should the user be able to
enter a value in the field.  For existing orders, the order number should be
not editable.
Cyberwolf - 24 May 2006 20:28 GMT
I would code the on current event so the field can't be edited if there is an
existing value.  ie.  
if me.fieldname is not null then

fieldname.locked = true

else

fieldname.locked = false

THis is untested and may need to be tweaked.
end if
Signature

James Gaylord
Finder of Paths, Hunter of Prey
Ghost of the Night, Shadow of Day
The Wolf

> I'm trying to add logic to my VB code to not allow changing of a field (for
> example, an existing order number).   I added logic in VB code of the Before
[quoted text clipped - 4 lines]
> enter a value in the field.  For existing orders, the order number should be
> not editable.
Larry Daugherty - 24 May 2006 21:46 GMT
One way that will get the job done is to set the control's Enabled
property Off.  Then, in the form's OnCurrent event, test the control's
value for null.  If it is null then MyControl.enabled = True.  Else
MyControl.enabled=False

Once the record is saved with a non-null value the control will be
disabled.

You may want to make that one control Bold so the number is still easy
to read.

HTH
Signature

-Larry-
--

> I'm trying to add logic to my VB code to not allow changing of a field (for
> example, an existing order number).   I added logic in VB code of the Before
[quoted text clipped - 4 lines]
> enter a value in the field.  For existing orders, the order number should be
> not editable.
 
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.