I am trying to create a Lot# for a program I am writing and having a problem. The format I want for the Lot # is the numbers in the date (03/04/01 = 030401) followed by the # of lots ran on that day. For example, the Lot# for the 3rd lot run on 03/04/01 would be 030401-3.
Anyway....NP with getting the 030401- part.....now I need the # of lots already ran that day so I can take that number and determine the next Lot#.
If I go into the query portion of access and run the following query.....it works great.
SELECT Count(ToolingProduction.Date) AS CountOfDate
FROM ToolingProduction
WHERE (((Format([Date],"mmddyy")=Format([Forms]![Tooling_Production].[Date],"mmddyy"));
I then say strSQL = the above string and use it in dbs.OpenRecordset(strSQL, dbOpenSnapshot, dbReadOnly)
and get the following error. "Data Type Mismatch in Criteria Expression" What am I doing wrong? Why does it work fine one way and not the other?
PS....I change "mmddyy" to 'mmddyy' when assigning this string to strSQL. Also, if I remove the WHERE portion of the statement.....I don't get any errors....I just don't get the data I'm looking for.
Thanks for your help!
Anyway....NP with getting the 030401- part.....now I need the # of lots already ran that day so I can take that number and determine the next Lot#.
If I go into the query portion of access and run the following query.....it works great.
SELECT Count(ToolingProduction.Date) AS CountOfDate
FROM ToolingProduction
WHERE (((Format([Date],"mmddyy")=Format([Forms]![Tooling_Production].[Date],"mmddyy"));
I then say strSQL = the above string and use it in dbs.OpenRecordset(strSQL, dbOpenSnapshot, dbReadOnly)
and get the following error. "Data Type Mismatch in Criteria Expression" What am I doing wrong? Why does it work fine one way and not the other?
PS....I change "mmddyy" to 'mmddyy' when assigning this string to strSQL. Also, if I remove the WHERE portion of the statement.....I don't get any errors....I just don't get the data I'm looking for.
Thanks for your help!