G
Guest
I hope someone can help me with this. I inherited this database that I need
to include its table into another database. Things have gone smoothly except
when it comes to adding a new record into this table. The "Key" field is
made up of a letter code, the last digit of the fiscal year, and then a three
digit number. Up until a few weeks ago the fiscal year digit came before the
letter code, then the three digit number. The three digit number can be
repeated as long as it's not repeated with the same code letter. For example
I might have a code "5B102" and "5C102". Since I need to keep this format I
want to find the highest number in each letter group so I can increment it,
then created a new Record Identifier based on the incremented number. I'm
trying to find the highest record using an SQL statement in VBA, example:
"Select [CANumber] frm [tbl FA] where [CANumber] like '" & Chr(42) & X &
Chr(42) & "'". I have done a lot of SQL statements using the wild card this
way, but this time it doesn't like the "like" portion. I have gone into the
Query Builder, created the query, and it ran fine. When I pasted that into
my code, it won't work. Does anyone have any clues what I might be doing
wrong this time or why it won't work this way? Thanks.
to include its table into another database. Things have gone smoothly except
when it comes to adding a new record into this table. The "Key" field is
made up of a letter code, the last digit of the fiscal year, and then a three
digit number. Up until a few weeks ago the fiscal year digit came before the
letter code, then the three digit number. The three digit number can be
repeated as long as it's not repeated with the same code letter. For example
I might have a code "5B102" and "5C102". Since I need to keep this format I
want to find the highest number in each letter group so I can increment it,
then created a new Record Identifier based on the incremented number. I'm
trying to find the highest record using an SQL statement in VBA, example:
"Select [CANumber] frm [tbl FA] where [CANumber] like '" & Chr(42) & X &
Chr(42) & "'". I have done a lot of SQL statements using the wild card this
way, but this time it doesn't like the "like" portion. I have gone into the
Query Builder, created the query, and it ran fine. When I pasted that into
my code, it won't work. Does anyone have any clues what I might be doing
wrong this time or why it won't work this way? Thanks.