|
-
Aug 12th, 2005, 05:39 AM
#1
Thread Starter
Junior Member
Access Queries
I have a query which creates me a table from another depending on a value fed into it called the 'Reference' field e.g. containing: BDF/739/2005/0 (x number of rows)
What I now want to do is update that reference from BDF/739/2005/0 to BDF/739/2005/1 so that it adds a 1 to the end or a 2 or a 3 depending what the original end number was. Is there an SQL update query which can manipulate strings like this?
Any help on this would be much appreciated
-
Aug 12th, 2005, 06:20 AM
#2
Re: Access Queries
You could try the following if the reference starts at 0... if not then change the last digit to reflect, removing would set it to 1..
NewRef: Left([Reference],Len([reference])-1) & (DCount("RecordNumb","tblTest","RecordNumb<" & [Recordnumb])+1)-1
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Aug 12th, 2005, 06:52 AM
#3
Thread Starter
Junior Member
Re: Access Queries
not quite sure what you mean as Reference may be :
BDF/739/2005/1
BDF/739/2005/2
BDF/739/2005/3 etc.
Sorry for being simple but I dont understand how you used "RecordNumb" in the DCount function? Can you please explain it more?
-
Aug 12th, 2005, 07:03 AM
#4
Re: Access Queries
Should of Explained.. the Dcount part of the SQL takes the primarykey (needs to be sorted in ascending order) and creates a sequence counter, as explained in your earlier post..
It's just a field name, and will need to be changed to reflect your own primary key in the table..
Actually looking back at your problem.. I'm gonna need to change it slightly.. BRB
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Aug 12th, 2005, 07:12 AM
#5
Re: Access Queries
Here you go this is a string manipulation formula you can use..
NewRef: Left([Reference],InStrRev([Reference],"/")) & CLng(Mid([Reference],InStrRev([Reference],"/")+1))+1
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Aug 12th, 2005, 08:20 AM
#6
Thread Starter
Junior Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|