Problem with Temp file after deletions

XV1957

Registered User.
Local time
Today, 18:06
Joined
Aug 6, 2014
Messages
80
Hi Access Experts,
I use temporary files a lot, which sit in a linked database so as to avoid DB bloat.

Since I may re-use them over the course of a session, I start by deleting all records in the temporary file. See attached doc.

When I subsequently import an Excel sheet into that file, I can open the file manually and control that the import was successful.
When I then want to use that file in the same program, I invariably get problems. Being a self-taught Access programmer, I must be overlooking something basic.

The problem is that when I use this temporary file in a loop, the program does not seem to find the right values. In this example when it compares the order number from the window calling the program and the one stored in the temporary file, it returns a blank for the latter.

I find this strange, because when I look for the record count of the temporary file before the loop, it correctly gives the count, and I know the order number stored in the temporary file is the same, or at least, entirely looks the same.
What am I missing?
 

Attachments

then try concatenating the fields to empty string before testting, if this will help:

If Trim(Me.PUOrderNb & "")= Trim(rst!PuOrdNb & "") Then
‘ Here some processing
Else

''''
or you can sort using PuOrdNb, LineNb
 
Last edited:
...
..
The problem is that when I use this temporary file in a loop, the program does not seem to find the right values. In this example when it compares the order number from the window calling the program and the one stored in the temporary file, it returns a blank for the latter.
You're importing data from outside the database, one of the reason for what you are experiencing could be that data is not finished fetched and inserted into the table when you attacher the recordset to the table.
I would suggest you to insert a breakpoint in the line, (Set rst = db.OpenRecordset("SELECT * from tblImportPriceDemand001 order by LineNb", dbOpenDynaset)), and wait 10-15 seconds before executing the rest of the code.
If the above helps, then put in a "DoEvents" in your code.
 
Re: Problem with Temp file after deletions - SOLVED

Hi ArnelGP and JHP for your kind and quick response,
All my fault, my Excel Table had a blank line somehow, and I did not test for it. As a result, Access could not find or use the record.
Sorry I wasted your time!
 
Good you find the problem. Good luck. :)
 

Users who are viewing this thread

Back
Top Bottom