K
Kastor
After reading about the evils of lookup fields, I've been trying to rid
my database of them, but not with the desired results.
The suggested alternative is to use the RowSource property to populate
a combobox on the form.
I'm working on a CD database. In tblAlbums I had a lookup field Label,
which linked to tblLabels. The latter table has two fields: ID (primary
key, autonumber) and Label. So what I did is this: I deleted the
relationship between tblAlbums.Label and tblLabel.ID, changed the data
type from Number to Text, and on the Lookup tab, changed combobox to
textbox. Next, I put a combobox on my form with ControlSource =
tblAlbums.Label and RowSource = SELECT tblLabels.Label FROM tblLabels
ORDER BY tblLabels.Label. Note that the SQL statement does NOT contain
tblLabels.ID.
Result: not the label name, but a numeric value is stored in
tblAlbums.Label. This is not a problem as long as I'm working with the
form (where the numeric value is invisible), but when I generate a
report based on tblAlbums, I get a number instead of the label name,
which also means I cannot sort alphabetically on label.
What perplexed me most, is that even when I delete tblLabels.ID, Access
still stores a numeric value!
my database of them, but not with the desired results.
The suggested alternative is to use the RowSource property to populate
a combobox on the form.
I'm working on a CD database. In tblAlbums I had a lookup field Label,
which linked to tblLabels. The latter table has two fields: ID (primary
key, autonumber) and Label. So what I did is this: I deleted the
relationship between tblAlbums.Label and tblLabel.ID, changed the data
type from Number to Text, and on the Lookup tab, changed combobox to
textbox. Next, I put a combobox on my form with ControlSource =
tblAlbums.Label and RowSource = SELECT tblLabels.Label FROM tblLabels
ORDER BY tblLabels.Label. Note that the SQL statement does NOT contain
tblLabels.ID.
Result: not the label name, but a numeric value is stored in
tblAlbums.Label. This is not a problem as long as I'm working with the
form (where the numeric value is invisible), but when I generate a
report based on tblAlbums, I get a number instead of the label name,
which also means I cannot sort alphabetically on label.
What perplexed me most, is that even when I delete tblLabels.ID, Access
still stores a numeric value!