Solved Copying data from a form

ZombeWalker71

New member
Local time
Today, 08:06
Joined
Mar 13, 2020
Messages
5
Sounds easy but struggling.

I have a form that displays the current number of records from a table using COUNT [TodayCount], which works absolutely fine.

I've created a table tblSKUCount to store this figure called [YesterdayCount], this just needs to be one row of data

Back on my form I then created a text box called [txtYestCount] that uses a Dlookup to bring in the value from the tblSKUCount.

I now want to press a command button in my form that will copy the [TodayCount] into the forms [txtYestCount] which then overwrites the value in the tables field
OR
it will overwrite the value directly in the table [YesterdayCount] and subsequently update the value in my form.

It sounds easy, but I just can't figure this one out.
 
You can always calculate this, so I don't see any obvious need to store it, and have to ensure it is accurate, and always updated.
It seems a lot of steps for something that is readily available with a simple DCount()

What purpose does it serve?
 
You can always calculate this, so I don't see any obvious need to store it, and have to ensure it is accurate, and always updated.
It seems a lot of steps for something that is readily available with a simple DCount()

What purpose does it serve?
Hi Minty, each day I count the current number of skus using the DCount and I get that figure which works fine.

The next day, when I run a few queries, I need to run the DCount again, I know I will get a different figure as the system is constantly adding/deleting records.

Its just a quick visual check to show me everything is ok.

if it displays a count of 50000 and yesterdays count was 50500, that is acceptable.

If it displays a count of 126 compared with 50500, then I have a problem that needs investigating.

So I need to
 
Maybe try something like this in the click event of your button:
Code:
CurrentDb.Execute "Update tblSKUCount Set YesterdayCount = " & Me.TodayCount,dbFailOnError
Me.Requery
Cheers,
 
Maybe try something like this in the click event of your button:
Code:
CurrentDb.Execute "Update tblSKUCount Set YesterdayCount = " & Me.TodayCount,dbFailOnError
Me.Requery
Cheers,
Perfect, works just how I wanted it too, thank you!
 

Users who are viewing this thread

Back
Top Bottom