I have a table of 8 digit numbers
I would like to update the last 2 digits to "00"
and would then copy to a new field and then update digit positions 5 & 6 to "00"
Foolishly I tried ??????00
can anyone help
many Regards
I have a table of 8 digit numbers
I would like to update the last 2 digits to "00"
and would then copy to a new field and then update digit positions 5 & 6 to "00"
Foolishly I tried ??????00
can anyone help
many Regards
Left(YourField,6) & "00"
Why are you updating 5 & 6 to 0, when you said last 2 digits of an 8 digit field?
If you are also changing 5 and 6, then just adjust the values above.
Create a query with the adjusted values as an extra column to check.
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
if it is a number you can use
?(12345478\100)*100
12345400
and similarly for your next stage
?(12345400 \10000)*10000
12340000
Thanks trying to do, unsuccessfull so far ha ha
But thanks for the second tip
You are so helpfull
My field name is L3 and am Struggling here I have tried to change just the last character i.e. Left(L3,8) & "0" without success
do I paste this code into SQL or in the query view and do I use an update query?????
Sorry for my ignorance
will try the 2nd solution now; they are all numeric values
Hi CJ
have tried without success, do I paste the above code in SQL view or Design View
Sorry
Dave
To actually update the values you would use an update query and have the expressions given to you in the UpdateTo row in query design.
Cheers,
well if there are only 8 character then all you are doing is appending a 0.My field name is L3 and am Struggling here I have tried to change just the last character i.e. Left(L3,8) & "0" without success
Also 'without success' does not help us to help you. What does 'without success' mean?
Look up the syntax for the Left() function, as for an 8 digit field Left(L3,8) & "0" is nonsense. That just makes a 9 digit field.My field name is L3 and am Struggling here I have tried to change just the last character i.e. Left(L3,8) & "0" without success
do I paste this code into SQL or in the query view and do I use an update query?????
Sorry for my ignorance
will try the 2nd solution now; they are all numeric values![]()
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
That is why you try it first as a calculated field in a select query to view it side by side with the original field and if happy with what you see then you take the expression and use it in the update.
Cheers,
Thanks everyone for all you messages, especially CJ where he said what does without success mean!!!
Here is a pdf that shows the original data, the update query and the result of running the query
what am I doing wrong???
Regards
dave
You have Left("L3",6)& "00
You are using L3 as a literal, literally the word L3, not the field L3
Look at my syntax. Replace YourField with L3. No quotes are required except for the 00
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Where? Maybe I could figure that out on my own but I'd rather not have to download, unzip and poke around in your file to try to figure that out.and would then copy to a new field and then update digit positions 5 & 6 to "00"
If it's an 8 digit field and you update digits 7 and 8 to 00 and then digits 5 and 6 to 00 then why not just change the last four to 0000 in either the new field or the existing one? Then it can just be myField = (myField\1000)*1000 as CJ indicated. NOTE: you must use \ and not /.
Left() is a string function and I don't see that working if your field is actually numeric. I think that function can only return a string, so you will likely get a data type mismatch error if you try to use it.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
In fact, as you are doing it to all the records, you could say it is calculated, and leave the original data well alone?
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba