Requery syntax for Access Forms

N

Nat Vascular

Hello and thanks for helping!

I'm trying to write an event procedure to requery a combobox on one form
form another open form. After reading through many posts it appears that the
code should look like:

Forms!FormName!ControlName.Requery

My problem seems to be that I have used form and control names with spaces
in them and I keep getting compile errors in the event procedure builder. My
exact line of code is:

Forms!Case Data Table!Balloon Sizes.Requery

It seems to choke on the first space after Case. I have tried with
underscores, I have tried just squeezing the form name together and nothing
seems to work. I'm guessing I just don't understand the syntax required to
indicate Access forms and controls. I would appreciate it if someone could
help.

Thanks so much!
 
J

J. Goddard

Hi -

You just need to put the names in square brackets:

Forms![Case Data Table]![Balloon Sizes].Requery

I like to put all my field and form names in brackets, even if they
don't contain spaces. It makes the code easier to read - just my own
preference, though.

John
 
V

Van T. Dinh

Try:

Forms![Case Data Table]![Balloon Sizes].Requery

It is likely that Access also creates the standard names for your Form /
Control replacing space with undescore character. Try:

Forms!Case_Data_Table!Balloon_Sizes.Requery

That's why it is better to use some standard naming convention and all
conventions (AFAIK) advise not to use space or other special characters in
Object names, Field names, etc ...
 
N

Nat Vascular

Thanks to both of you for responding. That did the trick! I swear I tried
that yesterday, but I must have missed something. Thanks also Van for the
tip on naming standards. I will begin to incorporate that in my programming.

Mike

Van T. Dinh said:
Try:

Forms![Case Data Table]![Balloon Sizes].Requery

It is likely that Access also creates the standard names for your Form /
Control replacing space with undescore character. Try:

Forms!Case_Data_Table!Balloon_Sizes.Requery

That's why it is better to use some standard naming convention and all
conventions (AFAIK) advise not to use space or other special characters in
Object names, Field names, etc ...

--
HTH
Van T. Dinh
MVP (Access)



Nat Vascular said:
Hello and thanks for helping!

I'm trying to write an event procedure to requery a combobox on one form
form another open form. After reading through many posts it appears that
the
code should look like:

Forms!FormName!ControlName.Requery

My problem seems to be that I have used form and control names with spaces
in them and I keep getting compile errors in the event procedure builder.
My
exact line of code is:

Forms!Case Data Table!Balloon Sizes.Requery

It seems to choke on the first space after Case. I have tried with
underscores, I have tried just squeezing the form name together and
nothing
seems to work. I'm guessing I just don't understand the syntax required
to
indicate Access forms and controls. I would appreciate it if someone
could
help.

Thanks so much!
 
N

Nat Vascular

Thanks John! That did the trick! And thanks for the tip on keeping object
and control names in Brakets. It is a great tip.


J. Goddard said:
Hi -

You just need to put the names in square brackets:

Forms![Case Data Table]![Balloon Sizes].Requery

I like to put all my field and form names in brackets, even if they
don't contain spaces. It makes the code easier to read - just my own
preference, though.

John


Nat said:
Hello and thanks for helping!

I'm trying to write an event procedure to requery a combobox on one form
form another open form. After reading through many posts it appears that the
code should look like:

Forms!FormName!ControlName.Requery

My problem seems to be that I have used form and control names with spaces
in them and I keep getting compile errors in the event procedure builder. My
exact line of code is:

Forms!Case Data Table!Balloon Sizes.Requery

It seems to choke on the first space after Case. I have tried with
underscores, I have tried just squeezing the form name together and nothing
seems to work. I'm guessing I just don't understand the syntax required to
indicate Access forms and controls. I would appreciate it if someone could
help.

Thanks so much!
 

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

Similar Threads


Top