iccsi wrote:
[Quoted Text] >On Dec 2, 12:53 pm, Marshall Barton <marshbar...[ at ]wowway.com> wrote: >> iccsi wrote: >> >I have a report to support 2 languages. >> >> >I have 2 languages in the table and retreive depends on user prefer >> >language select. >> >> >The report has more than one hundred labels to print. >> >> >I would like to know to use Dlookup to assign label caption or using >> >recordset to get data in one shot and assign the label using tag >> >property. >> >> A DLookup is essentially a query that returns one field >> value. If you have to get more than a couple of values, you >> are better off opening a recordset and using it to get all >> the values by running a single query. If there a a ton of >> records and you have to search for each value, you may(?) >> need to make it a table type recordset and use Seek to >> search for the needed values. >> >> I don't see where the Tag property comes into it. >> > >I named label like lblResult which needs a numeric to match ID in the >database. I assign a Tag number to match ID number in the recordset or >table.
Ahhh, that makes sense. Instead of the tag I sometimes have put the ID number as part of the name (easier to see?). E.g. lblX123, then the ID can be obtained by using the Mid function as in code like:
For Each ctl In Me.Controls If ctl.Name Like "lblX*" Then ID = Mid(ctl.Name, 5) rs.Seek ID If rs.NoMatch Then ctl.Caption = "Not in table" Else ctl.Caption = rs!French End If ` End If Next ctl
It doesn't really make that much difference unless the Tag property is also needed for another purpose.
-- Marsh MVP [MS Access]
|