Unlock Form based on Combo Box Selection

djwave

New member
Local time
Today, 19:55
Joined
Mar 17, 2014
Messages
5
Hi! I am a regular visitor of this site looking for solution on some access issues and I managed to solved all through the help of this forum but this time, I find this one so hard to do.


I have two forms linked together.


frmMaterialRequest
MaterialRequest
Status

frmHandledBy

MaterialRequest
HandledBy


What I want is to meet the following:
- Form 2 to be locked but its "MaterialRequest" is enabled.
- HandledBy to be unlocked if the MaterialRequest meets the "Status" of "frmMaterialRequest" which is "Approved".
 
Are these forms always open at the same time?

Do you always want frmHandledBy to be locked? If so, just set the locked property for all the controls except "MaterialRequest" to yes.

For changing the locked property depending on the status of the control in frmMaterialRequest, you need some basic code in the after update event of the Status control:

Code:
If Me.StatusControlName = "Approved" Then
Forms.frmHandledBy.HandledByControlName.Locked=False
End If
 
You should also add an else statement:

Code:
If Me.StatusControlName = "Approved" Then
Forms.frmHandledBy.HandledByControlName.Locked=False
Else: Forms.frmHandledBy.HandledByControlName.Locked = True
End If
 
Are these forms always open at the same time?

Do you always want frmHandledBy to be locked? If so, just set the locked property for all the controls except "MaterialRequest" to yes.

For changing the locked property depending on the status of the control in frmMaterialRequest, you need some basic code in the after update event of the Status control:

Code:
If Me.StatusControlName = "Approved" Then
Forms.frmHandledBy.HandledByControlName.Locked=False
End If

these forms are not open at the same. yes, i want fmHandledBy always to be locked, and will only open depending on my combo box selection.
 
You should also add an else statement:

Code:
If Me.StatusControlName = "Approved" Then
Forms.frmHandledBy.HandledByControlName.Locked=False
Else: Forms.frmHandledBy.HandledByControlName.Locked = True
End If

hi! i can't get your code work :confused:
 
It won't work if the forms aren't both open at once. That is much more complicated.
 
is the material request control a lookup?

If so, you can set the row source to include the status column. Then you can make a hidden calculated control that shows the status on frmHandledBy (=[MaterialRequestControlName].[Column](#) . Then you can use simple code in the form's OnCurrent event.

There are other ways, too. It depends on the form's record source.
 
is the material request control a lookup?
Yes, the MaterialRequest [of frmHandledBy] is a lookup of MaterialRequest of frmMaterialRequest

If so said:
this is easy.

Then you can make a hidden calculated control that shows the status on frmHandledBy (=[MaterialRequestControlName said:
.[Column](#).

my knowledge in access is basic, can you simplify this as soon as you have time.
 
Last edited:
How can it be a lookup of a control on another form? It should have a table or a query as its recordsource.

Can you show me table structure for the relevant tables?
 

Users who are viewing this thread

Back
Top Bottom