View Single Post
  #2  
Old April 14th, 2010, 11:46 PM posted to microsoft.public.access.tablesdbdesign
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Using Lookup Query with Calculated Value in Table ComboBox

I have done this with text boxes but have not tried with combo --

Use a text box for first and last name and combo box with AutoExpand on top
of the text box. Set the BackStyle and BorderStyle property of combo to
transparent.

Create a macro with two SetValue actions.
First sets the text box with first and last name.

Second sets combo box - Null

Set AfterUpdate property of combo box to call the macro.



--
Build a little, test a little.


"Matthew Pfluger" wrote:

Hello all,

This question takes a complicated setup, but I'll try to keep it brief. I
have a database with a main table (tblMain) and a lookup table (tblLookup).
tblMain has an integer field (LookupMe) that is related to the ID field in
tblLookup. I set up LookupMe to use a ComboBox input display control that
uses a query as its source. The query contains two columns: tblLookup.ID and
a calculated value, say "[First Name] & " " & [Last Name]". Back in tblMain,
the LookupMe field has the following properties:

Bound Column: 1
Column Count: 2
Column Heads: No
Column Widths: 0";3"
Limit to List: Yes
Allow Value List Edits: No

So, I've set up normalized tables and set up a ComboBox with a lookup query
that stores the ID, but displays the calculated value. Great, right? Well,
I can store and modify records, but when I try to use the AutoFilter feature
in tblMain's Datasheet view on the LookupMe field, I get the error "Syntax
error in query. Incomplete query clause." After playing around for a while,
I determined that the calculated value is the problem. When I redo the
LookupMe field's ComboBox's RecordSource to not display a calculated value,
the Autofilter feature works.

I can workaround this by finding another way to display data, but sometimes
I really want to display a calculated value. I would really appreciate it if
someone else can verify this problem and see if they can find a solution or
workaround.

Thanks for your help,
Matthew