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 / January 2008

Tip: Looking for answers? Try searching our database.

Problem with code!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dee - 31 Jan 2008 15:53 GMT
Hi,
I have had some success with the help received here in making controls in my
forms locked if they have already been filled in and unlocked if they are
empty to allow the initial data entry.

I now have another problem.  Two of the controls in question have default
values.  One has one character and the other has 2.  I have tried the code
below in variations, but only the box_no works, as it is simply empty of not.
The other two controls don't allow me to edit existing data, but also don't
allow me to enter the initial data!

Any suggestions would be greatly appreciated!

Signature

Thanks!

Dee

dee - 31 Jan 2008 15:57 GMT
Forgot to post code:
       Me.box_no.Locked = Not IsNull(Me.box_no)
       
    If Len(Me.txt_ppt_no) = 9 Then
    Me.txt_ppt_no.Locked = True
End If
    If Len(Me.txt_study_no & vbNullString) < 3 Then
    Me.txt_study_no.Locked = False
End If
Signature

Thanks!

Dee

> Hi,
> I have had some success with the help received here in making controls in my
[quoted text clipped - 8 lines]
>
> Any suggestions would be greatly appreciated!
Marshall Barton - 31 Jan 2008 17:33 GMT
>Forgot to post code:
>        Me.box_no.Locked = Not IsNull(Me.box_no)
[quoted text clipped - 5 lines]
>     Me.txt_study_no.Locked = False
>End If

I think you can get away with checking if they are the same
as the default value.

If Not (IsNull(Me.txt_ppt_no) Or Me.txt_ppt_no = _
                        Eval(Me.txt_ppt_no.DefaultValue)) Then
    Me.txt_ppt_no.Locked = True
End If
If Not (IsNull(Me.txt_study_no) Or Me.txt_study_no = _
                        Eval(Me.txt_study_no.DefaultValue)) Then
    Me.txt_study_no.Locked = False
End If

Signature

Marsh
MVP [MS Access]

dee - 31 Jan 2008 18:43 GMT
Hi Marshall,

Thanks so much.  I fiddled around with the code and it's working.  

I appreciate your help and sharing your knowledge!

Signature

Thanks!

Dee

> >Forgot to post code:
> >        Me.box_no.Locked = Not IsNull(Me.box_no)
[quoted text clipped - 17 lines]
>     Me.txt_study_no.Locked = False
> End If
 
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.