rs.nextRecordset problem

If you are building a data stream file then you have a couple of issues.

First, you COULD write a data stream using code to open a file and start pumping character sequences to it. Opening the file for output lets you write anything you want to the file as text, but your problem might be synchronizing your output to the requirements of the receiver of this file.

For instance, does the receiver expect some sort of record delimiter? If this is going to a UNIX system, your records would most often be delimited by a simple LineFeed (vbLF) character. I don't know what Excel wants for CSV file record delimiters, but would not be surprised to find that they like either vbCR, vbLF, or vbCrLf (but only one of those...). If you are sending a CSV formatted file but it is not actually going to Excel, then you need to know how to end a line.

Now, as to how you store that dataset, it might be ugly enough to do something like this:

table TaxMess
Field: PersonKey, LONG (part of compound PK)
Field: ItemKey, Long (part of compound PK)
Field: Datum, String - the value to be displayed for the particular item.
Field: Sep, String - either an empty string (zero length) or a comma.

Then you would have a nested loop, which I will NOT put into code, just pseudo-code

Open File "FUBAR.CSV" for Output Access Lock Read Write as #1 Len=32767

Set RS = CurrentDB.OpenRecordset( "HolyMess", dbOpenDynaset )

For PersK = 1 to MaxPersKey

For ItemK = 1 to MaxItemKey

RS.FindFirst "[PersonKey]=" & Cstr(PersK) & " AND [ItemKey] = " & Cstr(ItemK)

If NOT RS.NoMatch THEN

Write #1, RS.Datum & RS.Sep
End If

Next ItemK

Write #1, " " & {selected delimiter}

Next PersK

Close #1
RS.Close

This style (to be experimented with before you commit your business to it) gives you up to 4 billion persons (range of a LONG) and 4 billion attributes (range of a LONG) -but I'll bet you would use fewer than that. But the idea is that FIRST, you define item keys as the attributes you have to track, and for every person write a record with every item key (even if blank), where you pre-format what it will look like as a string, i.e. CStr(x) if it is a number.

This method WILL NOT allow you to write character strings longer than 255 bytes in a single operation - but if you lay out the item codes so that extended strings are consecutively numbered and the RS.Sep field is empty for strings that need to be concatenated, you could write longer strings by writing the first 255 with blank Sep, the next 255 with blank Sep, etc., and the last segment with "," in Sep.

For cases where you are just converting short numbers, Sep will ALWAYS be "," and for things that might be blanks, the Datam might be blank but Sep will not be.

Think about this as an approach. This essentially converts attributes that would be columns in your virtual long record into numbered short records where one key is the person and one key is the attribute number.

In the cases where you COULD write more than 1000 bytes between commas but in a given record do not have to, both Datum and Sep would be zero-length strings for the items corresponding to later portions of the string.
 
Hi jdraw and Doc Man

thanks for the replies, I went for weekend and needed it too.
Jdraw, I don't seem to find a solution to do what you are suggesting, but would be ideal per se, get record from table1 where empid = empid move to table2 get record where empid = empid Loop to next record table1 etc.
Doc Man, what you are suggesting seems to only work with one table too, if I understand correctly. I'm beginner VBA, so not too sure if I understand properly.
Another option might work is dlookup, but I'm not sure how effective this'll be with close to 200 statements like below.
Code:
If Not IsNull(rs!CompName) Then
            myline = myline & DLookup("[EMpCode]", "Emp501Codes", "[EmpCode] = 2010") & ","
        End If
Like that I can run table1 and table2 with dao.recordset as in the original code and then at the end of table2 run all the Dlookup fields. I'm a bit worried though that it will be very slow to process.
Thanks again for the help and effort guys. DocMan if you can correct me if I misunderstand your code please don't be shy. :)
 
I wrote what I wrote against a hypothetical table called TaxMess that had two distinct elements in it - a foreign key to a person table and a foreign key to a datum (property) table. The idea was and is expansible if there is a third factor that applies to every person, in which case it would be a third foreign key added to the TaxMess table. The order of that key would determine the order of appearance of persons, and would have to relate to something that would be part of the table of people.

The little pseudo-loop is designed as a two-pass algorithm in which you update information for each person's record by storing the string you want to export in the single datum of the table (along with that separator for cases where your string would overflow a ShortText field.) You do the update in any order necessary, but when you are finished, you drive the thing from the two-layered loop that does FindFirst for the combination of person and attribute.

The reason I did it that way is because your earlier narrative says you have to present either a value or an empty string between each set of commas and the values have to be in a specific order. The innermost loop thus has to be where it is to give you the properties in the right order. If there is a secondary ordering of people, then you need another foreign key in TaxMess that can be used for the outer layer of grouping.

To be honest, this is an ugly kind of data output and I have no way to test this against your real-life situation. Only you can do that testing.

I'm going to advise against DLookup if there is ANY WAY you can do a pre-join to include the values you are going to look up. In essence, a DLookup synthesizes a single value query inside of itself and implies a lot of data structure manipulation. I'm not going to say that DLoopkup actually does what I wrote below, but it behaves more or less like this:

Code:
Public Function DLookup( fFld AS FIELD, tTbl AS TABLE, sWhere as STRING ) AS VARIANT
Dim RS as DAO.Recordset
Dim DB as DAO.Database

Set DB = CurrentDB
Set RS = DB.OpenRecordset( tTBL, dbOpenTable, {don't know which options it uses})

RS.FindFirst sWHERE
If RS.NotFound Then
  DLookup = Null
Else
  DLookup = RS!fFld
End If 

RS.Close
SET RS = Nothing
DB.Close
SET DB = Nothing

End Function

In essence, every DLookup has to open, search, and close a new recordset. And you had better hope that your search criteria can take advantage of indexes, because otherwise you are doing a table scan. If you can do this via a JOIN, then Access will optimize the entire operation and open only one explicit recordset (plus maybe a couple of implied ones).
 
Pseudo-code or not, just be aware of that RS.NotFound doesn't exist, correct is RS.NoMatch.
 
Thanks for the detailed explanation, I will give it a go and see if I can make it cooperate. I do have a common number to link all the tables I've got, EmpNo (EmployeeNo) is unique and can link all the way through.
I'll let you know.
Pete
 
JHB, thanks for the correction. I always get the names messed up when shooting from the hip. "NotFound" is the status code for the OTHER operating system I used to work with, OpenVMS. Sometimes the wires get crossed in this old, cob-webby brain of mine.
 
Yes I know about the messing up! :D
NotFound sound so correct, it could be one of the errors which could take a long time to find, so I thought I'd better draw attention to it was wrong. :)
 
My dearest advisers
I do apologies for the long delay getting back to you.
Doc Man, against your advise I did use DLookup as you can see below. To be honest, I tried for a day to make sense with your logic, but it was just way over my head. I ended up copy and paste the Dlookup formula 100 times to see how slow it would become, and was surprised that is was actually really fast. Therefore I went with that, mainly because I could understand it and it works. I'm sure if one has thousends of records it will get slow, but I can't see our company expanding beyond 50 staff, so it should suffice.
I don't think it's ellegant but......

What I have now is the 4 temp tables I "Dim" at the beginning (instead of the one I used to have), I related them as suggested and then run my loops. The Employee details is the table where the tax man no matter how hard he tries, can add the least amount of fields, even going into the future, therefore I picked that one for DLookup the data.
The code below, I cut most of the repeated lines out of it, to make it more readable.

Thank you for the input and help all of you guys provided, I appreciate it tremendously.
Until my next problem

Code:
Option Compare Database



Sub sbExportAll501()
    ' create your own csv
    'DoCmd.OpenQuery "QEMP501Comp", , acEdit
    
    Dim db As Database
    Dim rs As DAO.Recordset
    Dim rs1 As DAO.Recordset
    Dim rs2 As DAO.Recordset
    Dim rs3 As DAO.Recordset
    
    
    Dim myline As String
    Set db = CurrentDb
    Set rs = db.OpenRecordset("EMP501CompDet")
    Set rs1 = db.OpenRecordset("EMP501EmpDet")
    Set rs2 = db.OpenRecordset("EMP501Totals")
    Set rs3 = db.OpenRecordset("Emp501IncomeDetails")
    Dim Path As String
    Dim FileName As String
    Dim PeriodAss As String
    Path = [Forms]![EMP501]![ExportPath]
    FileName = "Emp501 Easyfile.csv"
    PeriodAss = Format([Forms]![EMP501]![ToDate], "MM-yyyy")
        Open [Path] & "\" & PeriodAss & " " & FileName For Output As #1
    
    'Open "C:\Users\Server\Documents\Accounting\Emp501.csv" For Output As #1
       Do While Not rs.EOF
       
        If Not IsNull(rs!C1) Then
            myline = myline & rs!C1 & ","
        End If
        If Not IsNull(rs!CompName) Then
            myline = myline & rs!CompName & ","
        End If
		
			'Repeated code for each field 
			
        If Not IsNull(rs!C21) Then
            myline = myline & rs!C21 & ","
        End If
        If Not IsNull(rs!ComCountryCode) Then
            myline = myline & rs!ComCountryCode & ","
        End If
        If Not IsNull(rs!C25) Then
            myline = myline & rs!C25 & ","
        End If
        
       
        
        ' Remove the last (useless comma)
        myline = Left(myline, Len(myline) - 1)
        Print #1, myline ' Or was it print #1, Myline ???
        rs.MoveNext
        myline = ""
    Loop

    
    Do While Not rs3.EOF
    
        If Not IsNull(DLookup("C50", "Emp501EmpDet", "[EmpNo] =" & rs3![EmpNo])) Then
            myline = myline & DLookup("C50", "Emp501EmpDet", "[EmpNo] =" & rs3![EmpNo]) & ","
        End If
			
			'Repeated same code about 60 times for each field, selected the smallest table with the least possiblity of added fields
			
        If Not IsNull(DLookup("AccRelation", "Emp501EmpDet", "[EmpNo] =" & rs3![EmpNo])) Then
            myline = myline & DLookup("AccRelation", "Emp501EmpDet", "[EmpNo] =" & rs3![EmpNo]) & ","
        End If
        
        
       If Not IsNull(rs3!c200) Then
            myline = myline & rs3!c200 & ","
        End If
        If Not IsNull(rs3!Income) Then
            myline = myline & Format(rs3!Income, "##########") & ","
        End If
			
			'repeat code for each field 
			
        If Not IsNull(rs3!C339) Then
            myline = myline & rs3!C339 & ","
        End If
        If Not IsNull(rs3!EtiFebT) Then
            myline = myline & Format(rs3!EtiFebT, "########0.00") & ","
        End If
        
        If Not IsNull(rs3!End) Then
            myline = myline & rs3!End & ","
        End If
        
           
       
        ' Remove the last (useless comma)
        myline = Left(myline, Len(myline) - 1)
        Print #1, myline ' Or was it print #1, Myline ???
        rs3.MoveNext
        
       
        myline = ""
    
      Loop
        
     

    Do While Not rs2.EOF
    
        If Not IsNull(rs2!C400) Then
            myline = myline & rs2!C400 & ","
        End If
        If Not IsNull(rs2!RecCount) Then
            myline = myline & rs2!RecCount & ","
        End If
        If Not IsNull(rs2!C401) Then
            myline = myline & rs2!C401 & ","
        End If
        If Not IsNull(rs2!TotalCodes) Then
            myline = myline & Round(rs2!TotalCodes, 0) & ","
        End If
        If Not IsNull(rs2!C402) Then
            myline = myline & rs2!C402 & ","
        End If
        If Not IsNull(rs2!totalAmounts) Then
            myline = myline & Format(rs2!totalAmounts, "############0.00") & ","
        End If
        If Not IsNull(rs2!End) Then
            myline = myline & rs2!End & ","
        End If
        
        ' Remove the last (useless comma)
        myline = Left(myline, Len(myline) - 1)
        Print #1, myline ' Or was it print #1, Myline ??? Write
        rs2.MoveNext
        myline = ""
    Loop

    Close
End Sub
 
I'm not sure, but I think that he means that you could do a joined query instead of a table to avoid using Lookup. When you set a recordset variable it doesn't need to be a table, it can be an SQL instruction as well.

So, for instance, you could do:
Code:
Set rs3 = db.OpenRecordset("SELECT Emp501IncomeDetails.*, Emp501EmpDet.* FROM Emp501IncomeDetails INNER JOIN Emp501EmpDet ON Emp501IncomeDetails.EmpNo = Emp501EmpDet.EmpNo;")
This way you have every information you need without the need of DLookup, which can be really slow when you have tens of thousands of records to compare. If you might have registers in Emp501EmpDet that have no match within EmpNo then you should make the query a LEFT JOIN one, specify the fields that you'll use and, for the fields in Emp501EmpDet, make an "Nz" clause. Nz means that if a null value is returned by the instruction passed as first parameter, the value of the second parameter (which can be 0 or "" or anything else) will be used instead. So for instance
Code:
Nz(Emp501EmpDet.C50, "NotFound")
will return "NotFound" in the lines when there's no match between the tables.
 
Thanks Accessing
the problem with that is, I have to many fields and it gives me the error accordingly. That is where the whole trouble started.
Anyway, I know it's not a nice solution, but I wont have thousands of records. It's something to be avoided if one does have infinite records, but for the small temporary output it suffices and works.
See below SQL Code for just one query. And before anyone complains about cleaning up the code, I use query design grid and just copied and pasted it from there.
Code:
SELECT CompanyDetails.PAYENo, 3010 AS 50, fnCertNo([PAYENo],[TaxYear],[Forms]![EMP501]![ToDate],[Employees Detail]![EmpNo]) AS CertNo, 3015 AS 51, IIf(Sum([Tax(PAYE)])<>0,"IRP5","IT3(a)") AS IRP5, 3020 AS 52, tblNaturePerson.NatureCode AS Nature, 3025 AS 53, [Salaries YTD].TaxYear AS YearE, IIf([SumOfETI1]<>0,"3026","3026") AS 54, IIf([SumOfETI1]<>0,"Y","N") AS ETI, 3030 AS 55, [Employees Detail].LastName, 3040 AS 56, [FirstName] & " " & [MiddleName] AS FirstN, 3050 AS 57, [Employees Detail].Initials, IIf([IDTypeId]=1,3060,Null) AS 58, IIf([IDTypeId]=1,[IDNo],Null) AS IDNumber, IIf([IDTypeId]=2,3070,Null) AS 59, IIf([IDTypeId]=2,[IDNo],Null) AS PassPortNo, IIf([IDTypeId]=2,"3075",Null) AS 60, IIf([IDTypeId]=2,[CountryCode],Null) AS Country, 3080 AS 61, Format([BirthDate],"yyyymmdd") AS DoB, 3100 AS 62, [Employees Detail].TaxRefNumber, 3263 AS 63, CompanyDetails.SIC7 AS SIC7E, 3264 AS 64, CompanyDetails.SEZ AS SEZE, IIf([Employees Detail]![email] Is Null,Null,3125) AS 65, [Employees Detail].Email, 3136 AS 66, CompanyDetails.Phone, IIf([PhoneNo] Is Null,Null,3138) AS 67, [Employees Detail].PhoneNo, IIf([PHAddressUnit] Is Null,Null,3144) AS 68, CompanyDetails.PHAddressUnit, IIf([PHAddressComplex] Is Null,Null,3145) AS 69, CompanyDetails.PHAddressComplex, 3147 AS 70, CompanyDetails.[PHAddressStreet/Farm], 3149 AS 71, CompanyDetails.PHAddressCity, 3150 AS 72, CompanyDetails.PHAddressZIP, 3151 AS 73, CompanyDetails.ComCountryCode AS ComCountEmp, 3160 AS 100, [Employees Detail].EmpNo, 3170 AS 101, fnEmployFrom([Forms]![EMP501]![FromDate],[Forms]![EMP501]![ToDate],[DateOfEngagment],[DateOfTermination]) AS EmployPeriodFrom, 3180 AS 102, fnEmployTo([Forms]![EMP501]![FromDate],[Forms]![EMP501]![ToDate],[DateOfEngagment],[DateOfTermination]) AS EmployPeriodTo, 3200 AS 103, fnPeriodE([Forms]![Emp501]![FromDate],[Forms]![Emp501]![ToDate],[Employees Detail]![PayPeriod]) AS PayPeriodE, 3210 AS 104, fnPeriodsWork([Forms]![Emp501]![FromDate],[Forms]![Emp501]![ToDate],[Employees Detail]![PayPeriod],[DateOfEngagment],[DateOfTermination]) AS PeriodWork, 3214 AS 105, [Employees Detail].AddressStreet, 3216 AS 106, [Employees Detail].AddressTown, 3217 AS 107, [Employees Detail].ZipCode, 3285 AS 108, CompanyDetails.ComCountryCode AS POCountCodeEmp, 3279 AS 109, IIf([CareOf]=-1,"Y","N") AS COYN, IIf([CareOf]=-1,3283,Null) AS 110, IIf([CareOf]=-1,[CareOfName],Null) AS COName, 3288 AS 111, IIf([PostAddress]=-1,1,IIf([StreetAddress]=-1,3,2)) AS PoStruct, IIf([PostAddress]=0 And [StreetAddress]=0,3249,Null) AS 112, IIf([StreetAddress]=-1 And [PostAddress]=-1,Null,IIf([POBox]=-1,"PO_BOX",IIf([PrivatBag]=-1,"PRIVATE_BAG",Null))) AS POBox1, IIf([PostAddress]=0 And [StreetAddress]=0,3262,Null) AS 113, IIf([PostAddress]=0 And [StreetAddress]=0,[POBox/PrivBagNo],Null) AS BoxNumber, IIf([PostAddress]=0 And [StreetAddress]=0,"3253",Null) AS 114, IIf([PostAddress]=0 And [StreetAddress]=0,[POCity],Null) AS PostOffice, IIf([PostAddress]=0 And [StreetAddress]=0,"3254",Null) AS 115, IIf([PostAddress]=0 And [StreetAddress]=0,[POZIPCity],Null) AS PostZip, IIf([PostAddress]=0 And [StreetAddress]=0,"3286") AS 116, IIf([PostAddress]=0 And [StreetAddress]=0,[ComCountryCode]) AS POCountCode, IIf([StreetAddress]=-1,3258,Null) AS 117, IIf([StreetAddress]=-1,[POStreetAddress],Null) AS POStreetName, IIf([StreetAddress]=-1,3260,Null) AS 118, IIf([StreetAddress]=-1,[POCity],Null) AS POCityName, IIf([StreetAddress]=-1,3261,Null) AS 119, IIf([StreetAddress]=-1,[POZipCity],Null) AS POPOCode, IIf([StreetAddress]=-1,3287,Null) AS 120, IIf([StreetAddress]=-1,[ComCountryCode],Null) AS POPOCountCode, 3240 AS 150, IIf([AccountTypeID] Is Null,0,IIf([AccountTypeID]=1,1,IIf([AccountTypeID]=2,2,5))) AS AccountT, IIf([BankAccount]=-1,"3241",Null) AS 151, [Employees Detail].AccountNo, IIf([BankAccount]=-1,"3242",Null) AS 152, [Employees Detail].BranchCode, IIf([BankAccount]=-1,"3243",Null) AS 153, [Employees Detail].BankName, IIf([BankAccount]=-1,"3244",Null) AS 154, [Employees Detail].Branch AS BranchName, IIf([BankAccount]=-1,"3245",Null) AS 155, IIf([BankAccount]=-1,[FirstName] & " " & [LastName],Null) AS AccountName, IIf([BankAccount]=-1,"3246",Null) AS 156, IIf([BankAccount]=-1,1) AS BankRel
FROM CompanyDetails INNER JOIN (tblNaturePerson INNER JOIN ((tblPension RIGHT JOIN (tblCountry RIGHT JOIN (ETISumQ RIGHT JOIN ([Salaries YTD] INNER JOIN [Employees Detail] ON [Salaries YTD].EmpNo = [Employees Detail].EmpNo) ON ETISumQ.EmpNo = [Employees Detail].EmpNo) ON tblCountry.CountryID = [Employees Detail].CountryIssued) ON tblPension.PensionID = [Employees Detail].Annuity_Pension) LEFT JOIN Emp501ETIPrep ON [Employees Detail].EmpNo = Emp501ETIPrep.EmpNo) ON tblNaturePerson.NatureID = [Employees Detail].NatureOfPerson) ON CompanyDetails.Index = [Employees Detail].CompanyID
WHERE ((([Salaries YTD].PayDate) Between [Forms]![EMP501]![FromDate] And [Forms]![EMP501]![ToDate]))
GROUP BY CompanyDetails.PAYENo, 3010, 3015, 3020, tblNaturePerson.NatureCode, 3025, [Salaries YTD].TaxYear, IIf([SumOfETI1]<>0,"3026","3026"), IIf([SumOfETI1]<>0,"Y","N"), 3030, [Employees Detail].LastName, 3040, [FirstName] & " " & [MiddleName], 3050, [Employees Detail].Initials, IIf([IDTypeId]=1,3060,Null), IIf([IDTypeId]=1,[IDNo],Null), IIf([IDTypeId]=2,3070,Null), IIf([IDTypeId]=2,[IDNo],Null), IIf([IDTypeId]=2,"3075",Null), IIf([IDTypeId]=2,[CountryCode],Null), 3080, Format([BirthDate],"yyyymmdd"), 3100, [Employees Detail].TaxRefNumber, 3263, CompanyDetails.SIC7, 3264, CompanyDetails.SEZ, IIf([Employees Detail]![email] Is Null,Null,3125), [Employees Detail].Email, 3136, CompanyDetails.Phone, IIf([PhoneNo] Is Null,Null,3138), [Employees Detail].PhoneNo, IIf([PHAddressUnit] Is Null,Null,3144), CompanyDetails.PHAddressUnit, IIf([PHAddressComplex] Is Null,Null,3145), CompanyDetails.PHAddressComplex, 3147, CompanyDetails.[PHAddressStreet/Farm], 3149, CompanyDetails.PHAddressCity, 3150, CompanyDetails.PHAddressZIP, 3151, CompanyDetails.ComCountryCode, 3160, [Employees Detail].EmpNo, 3170, fnEmployFrom([Forms]![EMP501]![FromDate],[Forms]![EMP501]![ToDate],[DateOfEngagment],[DateOfTermination]), 3180, fnEmployTo([Forms]![EMP501]![FromDate],[Forms]![EMP501]![ToDate],[DateOfEngagment],[DateOfTermination]), 3200, fnPeriodE([Forms]![Emp501]![FromDate],[Forms]![Emp501]![ToDate],[Employees Detail]![PayPeriod]), 3210, fnPeriodsWork([Forms]![Emp501]![FromDate],[Forms]![Emp501]![ToDate],[Employees Detail]![PayPeriod],[DateOfEngagment],[DateOfTermination]), 3214, [Employees Detail].AddressStreet, 3216, [Employees Detail].AddressTown, 3217, [Employees Detail].ZipCode, 3285, CompanyDetails.ComCountryCode, 3279, IIf([CareOf]=-1,"Y","N"), IIf([CareOf]=-1,3283,Null), IIf([CareOf]=-1,[CareOfName],Null), 3288, IIf([PostAddress]=-1,1,IIf([StreetAddress]=-1,3,2)), IIf([PostAddress]=0 And [StreetAddress]=0,3249,Null), IIf([StreetAddress]=-1 And [PostAddress]=-1,Null,IIf([POBox]=-1,"PO_BOX",IIf([PrivatBag]=-1,"PRIVATE_BAG",Null))), IIf([PostAddress]=0 And [StreetAddress]=0,3262,Null), IIf([PostAddress]=0 And [StreetAddress]=0,[POBox/PrivBagNo],Null), IIf([PostAddress]=0 And [StreetAddress]=0,"3253",Null), IIf([PostAddress]=0 And [StreetAddress]=0,[POCity],Null), IIf([PostAddress]=0 And [StreetAddress]=0,"3254",Null), IIf([PostAddress]=0 And [StreetAddress]=0,[POZIPCity],Null), IIf([PostAddress]=0 And [StreetAddress]=0,"3286"), IIf([PostAddress]=0 And [StreetAddress]=0,[ComCountryCode]), IIf([StreetAddress]=-1,3258,Null), IIf([StreetAddress]=-1,[POStreetAddress],Null), IIf([StreetAddress]=-1,3260,Null), IIf([StreetAddress]=-1,[POCity],Null), IIf([StreetAddress]=-1,3261,Null), IIf([StreetAddress]=-1,[POZipCity],Null), IIf([StreetAddress]=-1,3287,Null), IIf([StreetAddress]=-1,[ComCountryCode],Null), 3240, IIf([AccountTypeID] Is Null,0,IIf([AccountTypeID]=1,1,IIf([AccountTypeID]=2,2,5))), IIf([BankAccount]=-1,"3241",Null), [Employees Detail].AccountNo, IIf([BankAccount]=-1,"3242",Null), [Employees Detail].BranchCode, IIf([BankAccount]=-1,"3243",Null), [Employees Detail].BankName, IIf([BankAccount]=-1,"3244",Null), [Employees Detail].Branch, IIf([BankAccount]=-1,"3245",Null), IIf([BankAccount]=-1,[FirstName] & " " & [LastName],Null), IIf([BankAccount]=-1,"3246",Null), IIf([BankAccount]=-1,1);

Anyway, thanks for your input and I hope I can use it somewhere else.
Take care
 

Users who are viewing this thread

Back
Top Bottom