A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Subform controls: ARGH!



 
 
Thread Tools Display Modes
  #1  
Old November 23rd, 2006, 02:08 PM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default Subform controls: ARGH!

Why can't I ever remember the code?

I have a search facility with two unbound boxes on a form. One of the boxes
I want to search is in a subform. This is what I have:

[forms]![Queries Form]![AddressDet].[form]![address1]

Is this correct?

I know I have to distinguish between the name of the form and the "box" in
which it sits in the main form.
  #2  
Old November 23rd, 2006, 02:12 PM posted to microsoft.public.access.forms
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Subform controls: ARGH!

"scubadiver" wrote in message
...
Why can't I ever remember the code?

I have a search facility with two unbound boxes on a form. One of the boxes
I want to search is in a subform. This is what I have:

[forms]![Queries Form]![AddressDet].[form]![address1]

Is this correct?

I know I have to distinguish between the name of the form and the "box" in
which it sits in the main form.


Looks correct. When in doubt use the builder. You get a nice GUI to navigate
to the control in question and in return get a reference that is guaranteed to
be correct.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com



  #3  
Old November 23rd, 2006, 03:55 PM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default Subform controls: ARGH!

I thought it was correct

I don't know whether you gathered the code is in VBA.

This is the code in its entirety as I have it now:



Dim rstClone As Object

Set rstClone = Me.RecordsetClone

rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And
[forms]![queries form]![Branch form].[form]![address1] = '" & Me.address & "'"

Me.Bookmark = rstClone.Bookmark

Set rstClone = Nothing

End Sub

Get the following message:

"The microsoft jet database engine does not recognise ....[ ]....as a valid
field name or expression".

????

"Rick Brandt" wrote:

"scubadiver" wrote in message
...
Why can't I ever remember the code?

I have a search facility with two unbound boxes on a form. One of the boxes
I want to search is in a subform. This is what I have:

[forms]![Queries Form]![AddressDet].[form]![address1]

Is this correct?

I know I have to distinguish between the name of the form and the "box" in
which it sits in the main form.


Looks correct. When in doubt use the builder. You get a nice GUI to navigate
to the control in question and in return get a reference that is guaranteed to
be correct.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com




  #4  
Old November 23rd, 2006, 04:02 PM posted to microsoft.public.access.forms
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Subform controls: ARGH!

"scubadiver" wrote in message
...
I thought it was correct

I don't know whether you gathered the code is in VBA.

This is the code in its entirety as I have it now:



Dim rstClone As Object

Set rstClone = Me.RecordsetClone

rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And
[forms]![queries form]![Branch form].[form]![address1] = '" & Me.address & "'"

Me.Bookmark = rstClone.Bookmark

Set rstClone = Nothing

End Sub

Get the following message:

"The microsoft jet database engine does not recognise ....[ ]....as a valid
field name or expression".


You should have the form reference outside the quotes...

rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And " &
[forms]![queries form]![Branch form].[form]![address1] & " = '" & Me.address &
"'"


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #5  
Old November 24th, 2006, 11:19 AM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default Subform controls: ARGH!

I assume there is a reason for the double quotes and ampersands around the
reference? Is it because the reference is in a subform?

[Forms]![Queries form]![branch form].Form![Address1]

I still have the above and the message is now: "Can't find the field 'branch
form' referred to in your expression". I still can't see what is going on!



"Rick Brandt" wrote:

"scubadiver" wrote in message
...
I thought it was correct

I don't know whether you gathered the code is in VBA.

This is the code in its entirety as I have it now:



Dim rstClone As Object

Set rstClone = Me.RecordsetClone

rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And
[forms]![queries form]![Branch form].[form]![address1] = '" & Me.address & "'"

Me.Bookmark = rstClone.Bookmark

Set rstClone = Nothing

End Sub

Get the following message:

"The microsoft jet database engine does not recognise ....[ ]....as a valid
field name or expression".


You should have the form reference outside the quotes...

rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And " &
[forms]![queries form]![Branch form].[form]![address1] & " = '" & Me.address &
"'"


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com



  #6  
Old November 24th, 2006, 11:58 AM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Subform controls: ARGH!

The reason for the quotes and ampersands is that the reference to the
control has to be outside of the quotes so that you get its value. The
FindFirst method is unable to resolve the field reference on its own.

For the error you're getting, make sure that the name of the control on
Queries form that holds the subform is named branch form. Depending on how
you added branch form as a subform to Queries form, the name of the control
may not be the same as the name of the form being used as a subform: it's
the name of the control you want in that statement.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"scubadiver" wrote in message
...
I assume there is a reason for the double quotes and ampersands around the
reference? Is it because the reference is in a subform?

[Forms]![Queries form]![branch form].Form![Address1]

I still have the above and the message is now: "Can't find the field
'branch
form' referred to in your expression". I still can't see what is going on!



"Rick Brandt" wrote:

"scubadiver" wrote in message
...
I thought it was correct

I don't know whether you gathered the code is in VBA.

This is the code in its entirety as I have it now:



Dim rstClone As Object

Set rstClone = Me.RecordsetClone

rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And
[forms]![queries form]![Branch form].[form]![address1] = '" &
Me.address & "'"

Me.Bookmark = rstClone.Bookmark

Set rstClone = Nothing

End Sub

Get the following message:

"The microsoft jet database engine does not recognise ....[ ]....as a
valid
field name or expression".


You should have the form reference outside the quotes...

rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And " &
[forms]![queries form]![Branch form].[form]![address1] & " = '" &
Me.address &
"'"


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com





  #7  
Old November 24th, 2006, 01:56 PM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default Subform controls: ARGH!

I am almost there but I get another error message: "run-time error "438".
Object doesn't support this property or method".


"Douglas J. Steele" wrote:

The reason for the quotes and ampersands is that the reference to the
control has to be outside of the quotes so that you get its value. The
FindFirst method is unable to resolve the field reference on its own.

For the error you're getting, make sure that the name of the control on
Queries form that holds the subform is named branch form. Depending on how
you added branch form as a subform to Queries form, the name of the control
may not be the same as the name of the form being used as a subform: it's
the name of the control you want in that statement.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"scubadiver" wrote in message
...
I assume there is a reason for the double quotes and ampersands around the
reference? Is it because the reference is in a subform?

[Forms]![Queries form]![branch form].Form![Address1]

I still have the above and the message is now: "Can't find the field
'branch
form' referred to in your expression". I still can't see what is going on!



"Rick Brandt" wrote:

"scubadiver" wrote in message
...
I thought it was correct

I don't know whether you gathered the code is in VBA.

This is the code in its entirety as I have it now:



Dim rstClone As Object

Set rstClone = Me.RecordsetClone

rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And
[forms]![queries form]![Branch form].[form]![address1] = '" &
Me.address & "'"

Me.Bookmark = rstClone.Bookmark

Set rstClone = Nothing

End Sub

Get the following message:

"The microsoft jet database engine does not recognise ....[ ]....as a
valid
field name or expression".

You should have the form reference outside the quotes...

rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And " &
[forms]![queries form]![Branch form].[form]![address1] & " = '" &
Me.address &
"'"


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com






  #8  
Old November 24th, 2006, 02:54 PM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default Subform controls: ARGH!

I am almost there!

The reference seems to work now because I also have the following error:

"The microsoft jet database engine does not recognise 'Add1e' as a valid
field name or expression".

add1e is a dummy address record in [address1]

"Douglas J. Steele" wrote:

The reason for the quotes and ampersands is that the reference to the
control has to be outside of the quotes so that you get its value. The
FindFirst method is unable to resolve the field reference on its own.

For the error you're getting, make sure that the name of the control on
Queries form that holds the subform is named branch form. Depending on how
you added branch form as a subform to Queries form, the name of the control
may not be the same as the name of the form being used as a subform: it's
the name of the control you want in that statement.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"scubadiver" wrote in message
...
I assume there is a reason for the double quotes and ampersands around the
reference? Is it because the reference is in a subform?

[Forms]![Queries form]![branch form].Form![Address1]

I still have the above and the message is now: "Can't find the field
'branch
form' referred to in your expression". I still can't see what is going on!



"Rick Brandt" wrote:

"scubadiver" wrote in message
...
I thought it was correct

I don't know whether you gathered the code is in VBA.

This is the code in its entirety as I have it now:



Dim rstClone As Object

Set rstClone = Me.RecordsetClone

rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And
[forms]![queries form]![Branch form].[form]![address1] = '" &
Me.address & "'"

Me.Bookmark = rstClone.Bookmark

Set rstClone = Nothing

End Sub

Get the following message:

"The microsoft jet database engine does not recognise ....[ ]....as a
valid
field name or expression".

You should have the form reference outside the quotes...

rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And " &
[forms]![queries form]![Branch form].[form]![address1] & " = '" &
Me.address &
"'"


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com






  #9  
Old November 24th, 2006, 03:04 PM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default Subform controls: ARGH!

If I open the form and do a search I get a "missing operator" error so I
think these two errors are related?

"scubadiver" wrote:

I am almost there!

The reference seems to work now because I also have the following error:

"The microsoft jet database engine does not recognise 'Add1e' as a valid
field name or expression".

add1e is a dummy address record in [address1]

"Douglas J. Steele" wrote:

The reason for the quotes and ampersands is that the reference to the
control has to be outside of the quotes so that you get its value. The
FindFirst method is unable to resolve the field reference on its own.

For the error you're getting, make sure that the name of the control on
Queries form that holds the subform is named branch form. Depending on how
you added branch form as a subform to Queries form, the name of the control
may not be the same as the name of the form being used as a subform: it's
the name of the control you want in that statement.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"scubadiver" wrote in message
...
I assume there is a reason for the double quotes and ampersands around the
reference? Is it because the reference is in a subform?

[Forms]![Queries form]![branch form].Form![Address1]

I still have the above and the message is now: "Can't find the field
'branch
form' referred to in your expression". I still can't see what is going on!



"Rick Brandt" wrote:

"scubadiver" wrote in message
...
I thought it was correct

I don't know whether you gathered the code is in VBA.

This is the code in its entirety as I have it now:



Dim rstClone As Object

Set rstClone = Me.RecordsetClone

rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And
[forms]![queries form]![Branch form].[form]![address1] = '" &
Me.address & "'"

Me.Bookmark = rstClone.Bookmark

Set rstClone = Nothing

End Sub

Get the following message:

"The microsoft jet database engine does not recognise ....[ ]....as a
valid
field name or expression".

You should have the form reference outside the quotes...

rstClone.FindFirst "[CustomerName] = '" & Me.Customer & "' And " &
[forms]![queries form]![Branch form].[form]![address1] & " = '" &
Me.address &
"'"


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com






  #10  
Old November 24th, 2006, 03:20 PM posted to microsoft.public.access.forms
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Subform controls: ARGH!

"scubadiver" wrote in message
...
The reference seems to work now because I also have the following error:

"The microsoft jet database engine does not recognise 'Add1e' as a valid
field name or expression".

add1e is a dummy address record in [address1]


When you get an error that indicates data is being treated as a field name then
that means you are missing text delimiters. For example, consider the following
two filter phrases...

SomeField = BlahBlahBlah

SomeField = 'BlahBlahBlah'

The first will be interpreted as "filter on records where the field SomeField is
equal to the field BlahBlahBlah". The second will be interpreted as "filter on
records where the field SomeField contains the string 'BlahBlahBlah'".

Your error suggests that within your filter string Add1e does not have quotes
around it when it should have.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:07 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.