473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Formatting with Lookup Fields

If I've got an AutoNumber field formatted as: \C0000 000 in Table A. If I attempt to create a Lookup field in Table B that targets the formatted table in Table A, 2 issues arise:

1) If the Lookup field does NOT allow multiple values: The formatting carries over and is treated as Text, hence creating an error as it does not meet the data type of the Lookup field (which is always Number)

2) If the Lookup field does allow multiple values: The formatting does not carry over (which is good). But MS Access does not allow it to be re-formatted.

I've done some digging around on the web but couldn't find anything on this. Any ideas?
Dec 1 '15 #1

✓ answered by zmbd

SourceOfAccess

IMNHO, and the opinion of many others, unless you are developing a sharepoint/Webapp application, the table-level lookup fields should be avoided like the plague.
See a recent discussion here:
Do Multivalue fields in Access, break normalization rules.
Therein is also a link to:
The Evils of Lookup Fields in Tables


mbizup suggestion about the general numeric formatting is something I personally do at the table level. I tend to do the formatting either in the query, form, and/or report.

As to what is happening... as you've ran into, the actual value shown in the LUF/MVF isn't actually what is being stored for that field... several of my posts in the aforementioned link cover that in detail.

My final suggestion, IMHO, it is best practice not to use the autonumber field for anything else than as a unique, one use, record id / primary key and rarely if ever for anything meaningful for the end user. I have done that in the past and been "burnt" rebuilding tables when the "lot" numbering scheme had to change from a simple system to one that had to be "special." If you need a "serial number" or "Sequence number" please use the search bar at the top of the page. We have had some really good coverage of these topics and it's a perennial favorite :)

5 1872
mbizup
80 64KB
I'd avoid formatting your numeric fields in the table's design. Instead, format the *display* to the user on an as-needed basis. Numbers can be formatted on the fly through code, queries or properties in your forms' design so that they can be displayed to the user in the format you want, without affecting their storage as *numbers* in the underlying tables.
Dec 1 '15 #2
zmbd
5,501 Expert Mod 4TB
SourceOfAccess

IMNHO, and the opinion of many others, unless you are developing a sharepoint/Webapp application, the table-level lookup fields should be avoided like the plague.
See a recent discussion here:
Do Multivalue fields in Access, break normalization rules.
Therein is also a link to:
The Evils of Lookup Fields in Tables


mbizup suggestion about the general numeric formatting is something I personally do at the table level. I tend to do the formatting either in the query, form, and/or report.

As to what is happening... as you've ran into, the actual value shown in the LUF/MVF isn't actually what is being stored for that field... several of my posts in the aforementioned link cover that in detail.

My final suggestion, IMHO, it is best practice not to use the autonumber field for anything else than as a unique, one use, record id / primary key and rarely if ever for anything meaningful for the end user. I have done that in the past and been "burnt" rebuilding tables when the "lot" numbering scheme had to change from a simple system to one that had to be "special." If you need a "serial number" or "Sequence number" please use the search bar at the top of the page. We have had some really good coverage of these topics and it's a perennial favorite :)
Dec 1 '15 #3
Thank you so much for your responses.

I was able to resolve the first problem by formatting the fields in the form, as both of you suggested.

However, I'm still unsure how I should go about solving the second issue, where I'm unable to format the values if multiple values are selected through Lookup - even if I try doing so in the forms/reports.

Ideas?
Dec 2 '15 #4
jforbes
1,107 Expert 1GB
I probably would have responded to this earlier, but don't fully understand the question. How is your Lookup implemented? Is it in the Table Definition in Access? Or is it a ComboBox on a Form that is allowing you to select from Table A and putting the Value into Table B? Either way, I don't understand how you can store multiple values in your lookup without resorting to multiple ComboBoxes or some code in the AfterUpdate Event of a ComboBox. It could be that Access allows this to happen in the Table Definition, but I've never used Table lookups as that method is specific to Access and isn't implemented in other database systems and languages.
Dec 2 '15 #5
zmbd
5,501 Expert Mod 4TB
SourceOfAccess:

You will have to expand your MVF by query, that is your only hope. MS>Guide to multivalued fields
The sections: "Modify the design of a multivalued field" and "How to employ a multivalued field in a query" will be your starting point and then there is the information to be found here Using multivalued fields in queries

IMHO: unless you are using SharePoint, you would be much better off to move to a 1:M or M:M type table relationships which will give you easier control over how you present the data to your end-users.
Dec 2 '15 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: David Allison | last post by:
Should Lookup fields be replaced by table normalisation? Then the Tables brought together in a Query for a Form to be based on? -- Dave Allison ~ Scotland
13
by: John Baker | last post by:
Hi: I have a general question about table access and look ups. Over simplifying things,and using a very theoretical example, lets say I have two tables; Client and Bill. The client table...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
2
by: David | last post by:
Would someone please explain how I can activate the pull down lookup fields in a db grid. I have created a SQL database within ACCESS and converted to SQL using the upsize wizard. The...
1
by: John Smith | last post by:
I am trying to combine two lookup fields into one field for display on a form and a report. I understand the basics behind how to do this: I set the control source for a new text box control to...
2
by: Lance Williams | last post by:
How can you programatically tell if a field in a table is a lookup field? I am looping through the fields collection and I want to see if any fields are lookup fields. Is there a property, or...
1
by: Paul Howarth | last post by:
Because I'm a novice, I can't reconcile a Recommendation to always avoid using Lookup Fields in Tables, and the Requirement to use Lookup Fields for a Published Access database. (Sources pasted...
10
by: Daedalus | last post by:
I'm trying to use relationships to link more than two tables. Using referencial intrgerity I can connect two tables so that by clicking a small + I can open one inside the other for the various...
0
by: cjr123 | last post by:
I want to have a button on a form to Duplicate a record. Not all of the fields would be duplicated. The code works until I use the fields that are Lookup Fields. I am not sure how to type the names...
2
by: feeeee | last post by:
I have seen again and again that lookup fields are to be avoided in tables. My question is: Are all types of lookup fields evil? I have avoided lookup fields that pull data from other tables. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.