Locking bound controls: Compile error when using tips Allen Browne

S

Sietske

I would like to lock my existing records, unless I press a button "unlock"
on the screen. From earlier posts on this forum, I found the hint that I
should try the tips page of Allen Browne, found here:
http://allenbrowne.com/ser-56.html

Other people have used this tip with success, but when I follow the
walkthrough step by step, I receive a compile error at step four, after I try
to set the On Load property of my form to
=LockBoundControls([Form],True)

The error says: "Compileerfout: verwacht regelnummer of naam of instructie
of instructie-eind", which must mean something like "Compile error: Expecting
line number or name or instruction or instruction end".

What does this mean? And how do I solve this problem? I'm quite a newbie
concerning VBA, so I would be pleased if someone could give me a hint.

Thanks in advance!
 
A

Allen Browne

Where did you post this line?

It is designed to go into the Properties box, beside the form's On Load
property. It does not go into the code window.
 
S

Sietske

Hi Allen,

Thanks for your reply, and my apologies in advance: I saw that you already
answered this question many times on several forums, and that this worked out
well for everyone you helped. However, it still didn't work for me and I'm
not experienced enough to figure out for myself what I did wrong.

I made a new event in "Bij Laden" (Dutch for "On Load") in the properties
box of the form. In the VBA-code window I put:

Private Sub Form_Load()
=LockBoundControls([Form],True)
End Sub

But this gave me the compile error mentioned earlier. Note that I tried it
another time just a moment ago, and now I receive a "Syntax Error" instead.

As an alternative, I tried your suggestion in another forum, and I put

Call LockBoundControls(Me, True)

in the "On Load" properties box, but this resulted in the error "kan de
macro Call LockBoundControls(Me,True) niet vinden", which means something
like "can not find the macro Call LockBoundControls(Me,True)".

Can you please tell me what is wrong here?


Sietske


Allen Browne said:
Where did you post this line?

It is designed to go into the Properties box, beside the form's On Load
property. It does not go into the code window.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Sietske said:
I would like to lock my existing records, unless I press a button "unlock"
on the screen. From earlier posts on this forum, I found the hint that I
should try the tips page of Allen Browne, found here:
http://allenbrowne.com/ser-56.html

Other people have used this tip with success, but when I follow the
walkthrough step by step, I receive a compile error at step four, after I
try
to set the On Load property of my form to
=LockBoundControls([Form],True)

The error says: "Compileerfout: verwacht regelnummer of naam of instructie
of instructie-eind", which must mean something like "Compile error:
Expecting
line number or name or instruction or instruction end".

What does this mean? And how do I solve this problem? I'm quite a newbie
concerning VBA, so I would be pleased if someone could give me a hint.

Thanks in advance!
 
S

Sietske

Inside the properties box, beside the form's On Load property? That is
strange... When I fill it in in the properties box, then I receive the error
message:

"De syntaxis van de expressie de u hebt opgegeven, is ongeldig", which means
something like "The syntaxis of the expression that you have given, is
invalid".

Can it be that, for some reason, the form can not find the module?

Allen Browne said:
Where did you post this line?

It is designed to go into the Properties box, beside the form's On Load
property. It does not go into the code window.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Sietske said:
I would like to lock my existing records, unless I press a button "unlock"
on the screen. From earlier posts on this forum, I found the hint that I
should try the tips page of Allen Browne, found here:
http://allenbrowne.com/ser-56.html

Other people have used this tip with success, but when I follow the
walkthrough step by step, I receive a compile error at step four, after I
try
to set the On Load property of my form to
=LockBoundControls([Form],True)

The error says: "Compileerfout: verwacht regelnummer of naam of instructie
of instructie-eind", which must mean something like "Compile error:
Expecting
line number or name or instruction or instruction end".

What does this mean? And how do I solve this problem? I'm quite a newbie
concerning VBA, so I would be pleased if someone could give me a hint.

Thanks in advance!
 
S

Sietske

Yes, it works now! This LockBoundControls([Form]),True) did not work,
wherever I put it, but using the call-code as you suggested on

http://awomantoldme.com/women/how-to/30502096/allowedits.aspx

works out really well!

Best regards,
Sietske

Allen Browne said:
Where did you post this line?

It is designed to go into the Properties box, beside the form's On Load
property. It does not go into the code window.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Sietske said:
I would like to lock my existing records, unless I press a button "unlock"
on the screen. From earlier posts on this forum, I found the hint that I
should try the tips page of Allen Browne, found here:
http://allenbrowne.com/ser-56.html

Other people have used this tip with success, but when I follow the
walkthrough step by step, I receive a compile error at step four, after I
try
to set the On Load property of my form to
=LockBoundControls([Form],True)

The error says: "Compileerfout: verwacht regelnummer of naam of instructie
of instructie-eind", which must mean something like "Compile error:
Expecting
line number or name or instruction or instruction end".

What does this mean? And how do I solve this problem? I'm quite a newbie
concerning VBA, so I would be pleased if someone could give me a hint.

Thanks in advance!
 

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