block Form


A

Adrian

Hello Group!

I have this code in a TOGGLE BUTTON to lock all Controls on a Form and SubForm (the same one, avoids the blockade of a command button and a textBox in order to make searches in the MainForm)

Private Sub Alternar163_Click()
Dim ctl As Control

For Each ctl In Me.Controls
If (TypeOf ctl Is TextBox) Or (TypeOf ctl Is ComboBox) Or (TypeOf ctl Is CheckBox) Or (TypeOf ctl Is SubForm) Then
If ctl.Locked = True Then
ctl.Locked = False
Else
ctl.Locked = True
End If
End If
Next

If Me.Alternar163.Caption = "Form bloqueado" Then
Me.Alternar163.Caption = "Form desbloqueado"
Else
Me.Alternar163.Caption = "Form bloqueado"
End If

Err.Clear
BUSCARNroIPP.TabStop = False
TXTBUSCAR.Locked = False

End Sub

......The Toggle Button , when loading form, remains Locked and when I need to change a registry I press it and it is unblocked.

What I need is that when happening to another registry, it becomes to activate the button.

Thanks a lot!
 
Ad

Advertisements

R

Rick B

What does this sentence mean?

"What I need is that when happening to another registry, it becomes to activate the button."

--
Rick B



Hello Group!

I have this code in a TOGGLE BUTTON to lock all Controls on a Form and SubForm (the same one, avoids the blockade of a command button and a textBox in order to make searches in the MainForm)

Private Sub Alternar163_Click()
Dim ctl As Control

For Each ctl In Me.Controls
If (TypeOf ctl Is TextBox) Or (TypeOf ctl Is ComboBox) Or (TypeOf ctl Is CheckBox) Or (TypeOf ctl Is SubForm) Then
If ctl.Locked = True Then
ctl.Locked = False
Else
ctl.Locked = True
End If
End If
Next

If Me.Alternar163.Caption = "Form bloqueado" Then
Me.Alternar163.Caption = "Form desbloqueado"
Else
Me.Alternar163.Caption = "Form bloqueado"
End If

Err.Clear
BUSCARNroIPP.TabStop = False
TXTBUSCAR.Locked = False

End Sub

.....The Toggle Button , when loading form, remains Locked and when I need to change a registry I press it and it is unblocked.

What I need is that when happening to another registry, it becomes to activate the button.

Thanks a lot!
 
A

Adrian

I want that, when I change the registry, toggle button, becomes to block
"Rick B" <Anonymous> escribió en el mensaje What does this sentence mean?

"What I need is that when happening to another registry, it becomes to activate the button."

--
Rick B



Hello Group!

I have this code in a TOGGLE BUTTON to lock all Controls on a Form and SubForm (the same one, avoids the blockade of a command button and a textBox in order to make searches in the MainForm)

Private Sub Alternar163_Click()
Dim ctl As Control

For Each ctl In Me.Controls
If (TypeOf ctl Is TextBox) Or (TypeOf ctl Is ComboBox) Or (TypeOf ctl Is CheckBox) Or (TypeOf ctl Is SubForm) Then
If ctl.Locked = True Then
ctl.Locked = False
Else
ctl.Locked = True
End If
End If
Next

If Me.Alternar163.Caption = "Form bloqueado" Then
Me.Alternar163.Caption = "Form desbloqueado"
Else
Me.Alternar163.Caption = "Form bloqueado"
End If

Err.Clear
BUSCARNroIPP.TabStop = False
TXTBUSCAR.Locked = False

End Sub

.....The Toggle Button , when loading form, remains Locked and when I need to change a registry I press it and it is unblocked.

What I need is that when happening to another registry, it becomes to activate the button.

Thanks a lot!
 
D

Dirk Goldgar

Adrian said:
Hello Group!

I have this code in a TOGGLE BUTTON to lock all Controls on a Form
and SubForm (the same one, avoids the blockade of a command button
and a textBox in order to make searches in the MainForm)

Private Sub Alternar163_Click()
Dim ctl As Control

For Each ctl In Me.Controls
If (TypeOf ctl Is TextBox) Or (TypeOf ctl Is ComboBox) Or
(TypeOf ctl Is CheckBox) Or (TypeOf ctl Is SubForm) Then
If ctl.Locked = True Then
ctl.Locked = False
Else
ctl.Locked = True
End If
End If
Next

If Me.Alternar163.Caption = "Form bloqueado" Then
Me.Alternar163.Caption = "Form desbloqueado"
Else
Me.Alternar163.Caption = "Form bloqueado"
End If

Err.Clear
BUSCARNroIPP.TabStop = False
TXTBUSCAR.Locked = False

End Sub

.....The Toggle Button , when loading form, remains Locked and when I
need to change a registry I press it and it is unblocked.

What I need is that when happening to another registry, it becomes to
activate the button.

Thanks a lot!

Obviously we have a language problem here, but I think you're saying
that when the form goes to another record you want the form to be
"unblocked", and you want the button to be in the "unblocked" state.

Try code like this in the form's Current event:

'----- start of code -----
Private Sub Form_Current()

If Me.Alternar163 = True Then
Me.Alternar163 = False
Call Alternar163_Click
End If

End Sub
'----- end of code -----
 
Ad

Advertisements

D

Dreamer

Dear Dirk Goldgar, you are a Genius! You understand me perfectly!!!!!!!!!!!!!!!!!

Thanks a lot!!!!

Hugs from Argentina

Adrian.-

--------------------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top