From: Matthew Pfluger on 14 Apr 2010 17:51 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
From: KARL DEWEY on 14 Apr 2010 18:46 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
From: Jeff Boyce on 23 Apr 2010 19:48 Matthew I may be mis-reading your description ... if so, my comments won't apply ... It sounds like you are trying to work directly in the tables, and using the Lookup data type. If so, that's your first and second mistakes. Access tables only store data. Access forms display data and offer a rich event environment so you can better control how and when data is displayed. Besides, in a well-normalized table structure, the foreign key fields will be mostly meaningless numbers (if you're using Access Autonumbers for your primary key fields). That's one... The lookup data type stores the key value, but displays something else, the looked-up value. This proves confusing over and over again. It also encourages working directly in the tables. Instead, use a combobox in a form. This way, what is stored in the underlying table is the value of the key, and that's what shows. But hey! I might be reading too much into what you posted...<g> Good luck! Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "Matthew Pfluger" <MatthewPfluger(a)discussions.microsoft.com> wrote in message news:9A02D0CA-28E3-4BF0-9F91-970C277E11B2(a)microsoft.com... > 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
|
Pages: 1 Prev: Do I have to set the primary key to include primary key fields Next: Vehicle Waiver Database |