Re: How to Find the Date of Last Change in Inventory



< If theses are the lines you are talking about, I don't know where
they came
from in relation to the code I sent.>

Two things I don't understand. First, who changed my original message
dated Jun 13, 9:24 am? The code I pasted there (with name changes) was
further edited and has blue writing in it to boot. I thought it was
you. I was a bit confused that my post was edited (looking as if I
wrote it) but thought it was some trick of this new google list. I
don't know why there is blue writing in there or who edited it.

Secondly, when I copy your code here and paste it into Access, it
changes it. For example, when I copy the line:

Set rstItems = qdf.OpenRecordset(dbOpenSnapsh?ot, dbReadOnly)

and paste into into Access, it turns it into this:

Set rstItems = qdf.OpenRecordset(dbOpenSnapsh?-ot, dbReadOnly)

putting a hyphen in the word "snapshot." But when I copy this line,
with the hyphen, into this page, it actually doesn't copy the hyphen.

I've never had these issues before.

< If your report has visibility to the query, then the query is the way
to go. >

I don't have a report yet, nor a query. I first need a query or, as
you suggested, a table. My goal is to have this table look something
like this:

Style Color SLOBDate SLOBDays
1912 White 06/10/05 20
1912 Black 06/10/05 90
1912 Pink 06/10/05 120
2012 White 06/10/05 20
2012 Gray 06/10/05 240

The SLOBDate may appear a bit useless, but I think it best to have it.

< If you could post the code as you modifided it, the lines that turn
red, and
the error message the lines are returning, maybe we can work through
it. >

Okay, here is your original code, with the new names:

Set qdf = CurrentDb.QueryDefs("SLOBInv1StyColqry")
Set rstItems = qdf.OpenRecordset(dbOpenSnapsh?ot, dbReadOnly)
rst.MoveLast
rst.MoveFirst
Do While Not rstItems.EOF
Set qdf = CurrentDb.QueryDefs("SLOBInv2StyColDatUntqry")
qdf.Parameters(0) = rstItems![Style]
qdf.Parameters(1) = rstItems![Color]
Set rstInventory = qdf.OpenRecordset(dbOpenSnapsh?ot,
dbReadOnly)
rst.MoveLast
rst.MoveFirst
dtmLastDate = rstInventory![SLOBDate]
intCount = rstInventory![OnHand]
rstInventory.MoveNext
If rstInventory.EOF Then
'No movement here
End If
Do While Not rstInventory.EOF
If rstInventory!OnHand = intCount Then
dtmFirstDate = rstInventory!OnHand
Else
'Now you have the count and dates to calculate
Exit Do
End If
rstInventory.MoveNext
Loop
rstInventory.Close
rstItems.MoveNext
Loop
________________________________

This code gets a varible not defined on "qdf =" and does not have any
red lines.

Could you explain what you want me to do with the code once it is done.
I haven't a clue what to do with it, frankly.

The way I see it now, I would like a button on a form that creates a
table with the data I need. The table being cleared first and
appended.

I'm sorry about these oddities. I hope you stick with it.

Matt

.


Loading