i am trying to update a field within a table. But i dont want to update the whole of the data within the field just one part of it.
The field is the Tutor Group for students in the format 7B, 7D, 7F, 7H, 7M, 7S, 8B, 8D, 8F,... etc where the number represents the year group! i want to use an expression that would add(+) 1 to the year group but leave the letter the same as this doesn change. By doing this the above list would change to 8B, 8D, 8F, 8H, 8M, 8S, 9B, 9D, 9F, ...etc
I attempted to use the following expression: ((*)+1)(*) but it didn't work.
I should have had the year groups separate but i am given an Excel flat file which has details of the students and doesnt separate the the two.
any help would be much appreciated! hope someone can help!
5 1265
i am trying to update a field within a table. But i dont want to update the whole of the data within the field just one part of it.
The field is the Tutor Group for students in the format 7B, 7D, 7F, 7H, 7M, 7S, 8B, 8D, 8F,... etc where the number represents the year group! i want to use an expression that would add(+) 1 to the year group but leave the letter the same as this doesn change. By doing this the above list would change to 8B, 8D, 8F, 8H, 8M, 8S, 9B, 9D, 9F, ...etc
I attempted to use the following expression: ((*)+1)(*) but it didn't work.
I should have had the year groups separate but i am given an Excel flat file which has details of the students and doesnt separate the the two.
any help would be much appreciated! hope someone can help!
Here is the basic logic: - Dim strTutorGroup As String, strNewGroup As String
-
-
strTudorGroup = "7C"
-
-
strNewGroup = CStr(Val(Left$(strTudorGroup, 1)) + 1) & Right$(strTudorGroup, 1)
-
-
Debug.Print strNewGroup 'produces 8C
Since the number is at the start, u may find VAL works just as well
so why not just try this, see if this works for you
eg a test module for you -
Public Sub TestTutorGroup()
-
Dim sTutorGroup As String
-
-
sTutorGroup = "9J"
-
-
MsgBox "Before: " & sTutorGroup
-
-
-
'Increment number by 1
-
sTutorGroup = Val(sTutorGroup) + 1 & Right$(sTutorGroup, 1)
-
-
-
MsgBox "After: " & sTutorGroup
-
End Sub
-
Here is the basic logic: - Dim strTutorGroup As String, strNewGroup As String
-
-
strTudorGroup = "7C"
-
-
strNewGroup = CStr(Val(Left$(strTudorGroup, 1)) + 1) & Right$(strTudorGroup, 1)
-
-
Debug.Print strNewGroup 'produces 8C
Thanks for your reply! But how do i use this the Query grid. i tried putting it in the Update to: field in the query grid but doesnt accept this? sorry about this, im new to Access. once again, thanks for ur help so far.
Thanks for your reply! But how do i use this the Query grid. i tried putting it in the Update to: field in the query grid but doesnt accept this? sorry about this, im new to Access. once again, thanks for ur help so far.
Simply set the "Update To" to the example code provided
i.e.
CStr(Val(Left$(strTudorGroup, 1)) + 1) & Right$(strTudorGroup, 1)
or
Val(strTudorGroup)+1 & Right$(strTudorGroup,1)
Note, strTudorGroup must be your fieldname
Since the number is at the start, u may find VAL works just as well
so why not just try this, see if this works for you
eg a test module for you -
Public Sub TestTutorGroup()
-
Dim sTutorGroup As String
-
-
sTutorGroup = "9J"
-
-
MsgBox "Before: " & sTutorGroup
-
-
-
'Increment number by 1
-
sTutorGroup = Val(sTutorGroup) + 1 & Right$(sTutorGroup, 1)
-
-
-
MsgBox "After: " & sTutorGroup
-
End Sub
-
Better solution, Thanks.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: windandwaves |
last post by:
Hi Folks
I have just completed a project for an accommodation finder in New Zealand - much with your help - thank you again.
I would appreciate any constructive or deconstructive comments.
...
|
by: da Vinci |
last post by:
OK, this has got to be a simple one and yet I cannot find the answer
in my textbook.
How can I get a simple pause after an output line, that simply waits
for any key to be pressed to move on?
...
|
by: Michael Orlando |
last post by:
Any help would be greatly appreciated.
My problem is that I need to set up a backup SQL Server 2000 machine
which can be used in case of a failure to my primary. All databases
(30 as of now)...
|
by: Andrew S. Giles |
last post by:
Hello everyone,
I am trying to deploy a project, and I cannot get it to work. Does anyone
have any ideas how I should be going about this, since the way I am
attempting is obviously wrong.
...
|
by: Bharat |
last post by:
Hi Folks,
Suppose I have two link button on a page (say lnkBtn1 and
lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically
created control. And On the click event of the lnkBtn2 I...
|
by: Tina |
last post by:
I have an asp project that has 144 aspx/ascx pages, most with large
code-behind files. Recently my dev box has been straining and taking long
times to reneder the pages in the dev environment. ...
|
by: . . |
last post by:
Hi
I am developing a web system using ASP.NET/VB.NET with SQL Server 2005
as back end database . I need to develop a aspx page where user can see
their messages after they log into the system...
|
by: SStory |
last post by:
Hi all,
I really needed to get the icons associated with each file that I want to
show in a listview.
I used the follow modified code sniplets found on the internet.
I have left in...
|
by: =?Utf-8?B?U2l2?= |
last post by:
I have a form that I programmatically generate some check boxes and labels on.
Later on when I want to draw the form with different data I want to clear
the previously created items and then put...
|
by: xi4n9 |
last post by:
im a newbie to action script stuff in flash,currently needed help on my 2nd flash annimation to work out. i would like to know how to pick up an item and put in down as i dont want to drag the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |