L
laavista
I need help. This seems like it should be so simple, but …
I'm using Access 2007.
I have two forms, f_MilBase and f_Contact. Both have the field “BaseCodeâ€
On form f_MilBase, I have a command button. On Click, I wish to have form
f_Contact open with just the records for the BaseCode populated in f_MilBase
BaseCode is a text field, 5 char
Examples of BaseCodes in the db: 5234E or Beale
====
1stTry
DoCmd.OpenForm "f_contact", _
WhereCondition:="BaseCode=" & Me.BaseCode
In this case, I get error “Syntax error in number in query expression
‘BaseCode=5234’. (The last digit is left off of the basecode in form1, which
is 5234E)
====
2ndTry
Dim strCode as String
DoCmd.OpenForm “f_Contactâ€,,,â€[BaseCode]=†& strCode
I get the same error as 1stTry
===
3rd try
If I try a different record in f_milBase, e.g., with a BaseCode of “Bealeâ€,
for both 1st & 2nd try, I get error “Enter Parameter Value (for BEALE)â€
==
4th try
I’ve also tried this with f_Contact having a sub_form, with f_MiliBase’s
“BaseCode†being on the main form and f_Contact being the subform. No luck.
Any suggestions would be GREATLY appreciated.
I'm using Access 2007.
I have two forms, f_MilBase and f_Contact. Both have the field “BaseCodeâ€
On form f_MilBase, I have a command button. On Click, I wish to have form
f_Contact open with just the records for the BaseCode populated in f_MilBase
BaseCode is a text field, 5 char
Examples of BaseCodes in the db: 5234E or Beale
====
1stTry
DoCmd.OpenForm "f_contact", _
WhereCondition:="BaseCode=" & Me.BaseCode
In this case, I get error “Syntax error in number in query expression
‘BaseCode=5234’. (The last digit is left off of the basecode in form1, which
is 5234E)
====
2ndTry
Dim strCode as String
DoCmd.OpenForm “f_Contactâ€,,,â€[BaseCode]=†& strCode
I get the same error as 1stTry
===
3rd try
If I try a different record in f_milBase, e.g., with a BaseCode of “Bealeâ€,
for both 1st & 2nd try, I get error “Enter Parameter Value (for BEALE)â€
==
4th try
I’ve also tried this with f_Contact having a sub_form, with f_MiliBase’s
“BaseCode†being on the main form and f_Contact being the subform. No luck.
Any suggestions would be GREATLY appreciated.