Results 1 to 3 of 3

Thread: Computed Fields

  1. #1
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Unanswered: Computed Fields

    I have Access 2003 installed, and I have a create table Query which hast first name, last name, and 2 computed fields firstLastName and LastFirstName.

    In a report I want to show sometimes (according to the user's choice) the first name + the last name OR the last name + the first name. So I used an unbounded box and bind it in the Detail_Format of the report.

    I noticed that if I use a computed field, it comes with an error message that it doesn't recognise this field, but if I use a normal field name (not computed), it functions ok.

    I use a query as a RecordSource of the Report. This query uses the created tabel (through the make table Query) as its source.

    Thanks

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Sounds like a case for iif inthe query to me
    UsersName: iif(booFlag,[Surname] & " " & [Forename],[Forename] & " " & [Surname])
    where booflag is a boolean flag derived from your table indicating if the customer wants surname first (true) or forenames first (false)
    HTH

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Thank you for your reply, I used the following code
    PHP Code:
    Private Sub Detailbereich_Format(Cancel As IntegerFormatCount As Integer)
       
      
    Select Case Forms("F_UKs").Frame_ShowNames
        
    Case Is 1
           xx2 
    Trim([vName_nName])       
          
        Case 
    Is 2
          xx2 
    = [nName_vName]
          
        Case Else
          
    xx2 Trim(Trim([pgd_name]) & ", " Trim([pgd_vornamen]))
      
    End Select 
    In case 1 and case 2 the vName_nName and nName_vName are computed Fields, while the pgd_name and the pgd_vornamen are given ones.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •