Subform controls: ARGH!
I have tried it when i first opened the form and this is what I get:
[CustomerName]= 'Joe Bloggs' And 5 cedar House = 'Add1c'
I *can* understand why this has happened.
To explain, my earlier version of the db was not properly designed. Each
customer can have more than one address (like a bank has more than one
branch) but I originally decided not to have a 1:m relationship so the
contact information would be in the main for with the customer name.
A part of the code I used (which worked perfectly ok) was the following:
rstClone.FindFirst "[CustomerName] = '" & Me.Cname & "' And [Address1] =
'" & Me.AddrSrch & "'"
The difference is that there are no quotes or ampersands around [Address1].
The ampersands picks up the information within the field rather than the name
of the field itself hence why I am getting
5 cedar House = 'Add1c'
instead of
[address1] = "5 Cedar House"
This suggests to me that I shouldn't have the ampersands in the current code
" & [Forms]![queries form]![Branch Form].[Form]![Address1] & "
If I remove them and re-run it, Access says it is an invalid field name or
expression yet when i look at the evaluation I get:
[CustomerName]= 'Joe Bloggs' And [Forms]![queries form]![Branch
Form].[Form]![Address1] = 'Add1c'
that is what I want.
I am wondering whether there is something to do with having a 1:m
relationship (or a form and subform) that is stopping the code from running
properly.
"Rick Brandt" wrote:
"scubadiver" wrote in message
...
I am not entirely sure what you mean by "debug" window. Is that the VBA code
window?
If you press Ctl-G the VBA editor window opens and one "pane" of that is the
immediate/debug window. That is where the Debug.Print command will place the
evaluated output of your string.
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
|