473,395 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Help needed on Up-date Query!

36
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!
Apr 11 '07 #1
5 1265
ADezii
8,834 Expert 8TB
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:
Expand|Select|Wrap|Line Numbers
  1. Dim strTutorGroup As String, strNewGroup As String
  2.  
  3. strTudorGroup = "7C"
  4.  
  5. strNewGroup = CStr(Val(Left$(strTudorGroup, 1)) + 1) & Right$(strTudorGroup, 1)
  6.  
  7. Debug.Print strNewGroup         'produces 8C
Apr 11 '07 #2
pks00
280 Expert 100+
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

Expand|Select|Wrap|Line Numbers
  1. Public Sub TestTutorGroup()
  2.     Dim sTutorGroup As String
  3.  
  4.     sTutorGroup = "9J"
  5.  
  6.     MsgBox "Before: " & sTutorGroup
  7.  
  8.  
  9.     'Increment number by 1
  10.     sTutorGroup = Val(sTutorGroup) + 1 & Right$(sTutorGroup, 1)
  11.  
  12.  
  13.     MsgBox "After: " & sTutorGroup
  14. End Sub
  15.  
Apr 11 '07 #3
atiq
36
Here is the basic logic:
Expand|Select|Wrap|Line Numbers
  1. Dim strTutorGroup As String, strNewGroup As String
  2.  
  3. strTudorGroup = "7C"
  4.  
  5. strNewGroup = CStr(Val(Left$(strTudorGroup, 1)) + 1) & Right$(strTudorGroup, 1)
  6.  
  7. 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.
Apr 11 '07 #4
pks00
280 Expert 100+
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
Apr 11 '07 #5
ADezii
8,834 Expert 8TB
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

Expand|Select|Wrap|Line Numbers
  1. Public Sub TestTutorGroup()
  2.     Dim sTutorGroup As String
  3.  
  4.     sTutorGroup = "9J"
  5.  
  6.     MsgBox "Before: " & sTutorGroup
  7.  
  8.  
  9.     'Increment number by 1
  10.     sTutorGroup = Val(sTutorGroup) + 1 & Right$(sTutorGroup, 1)
  11.  
  12.  
  13.     MsgBox "After: " & sTutorGroup
  14. End Sub
  15.  
Better solution, Thanks.
Apr 11 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

12
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. ...
31
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? ...
2
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)...
0
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. ...
10
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...
7
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. ...
8
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...
5
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...
32
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...
5
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.