473,503 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Edit conditional statements in vba via form.

14 New Member
Hi i have this code:
i want to make it available for user to change/edit the values i.e(marks range and grade) in a form. is it possible?

Expand|Select|Wrap|Line Numbers
  1. Public Function ValGrade(PrMark As Double) As String
  2. Select Case PrMark
  3. Case 80 To 100
  4. ValGrade = "A"
  5. Case 75 To 80
  6. ValGrade = "A-"
  7. Case 70 To 74
  8. ValGrade = "B+"
  9. Case 65 To 69
  10. ValGrade = "B"
  11. Case 60 To 64
  12. ValGrade = "B-"
  13. Case 55 To 59
  14. ValGrade = "C+"
  15. Case 50 To 54
  16. ValGrade = "C"
  17. Case 45 To 49
  18. ValGrade = "C-"
  19. Case 40 To 44
  20. ValGrade = "D+"
  21. Case 35 To 39
  22. ValGrade = "D"
  23. Case 30 To 34
  24. ValGrade = "D-"
  25. Case Else
  26. ValGrade = "E"
  27. End Select
  28. End Function

Attached Images
File Type: jpg final.jpg (37.3 KB, 326 views)
Sep 3 '13 #1
5 1223
jimatqsi
1,271 Recognized Expert Top Contributor
What you are asking for is very basic forms development. I think the best advice anyone can give you for now is to go to Help and look at the database sample(s) with your version of Access.You will find very good demonstrations of how to program in Access. Once you work through 1 or 2 examples in the sample db you will know how to do what you are asking about, or you'll be able to frame a more definitive question that we can answer here.

You will be surprised at how simple it quickly becomes for you.

Jim
Sep 3 '13 #2
sashasandy
14 New Member
thanks, surprisingly i have found the solution!!
by using lookup in a simple query.
Sep 3 '13 #3
jimatqsi
1,271 Recognized Expert Top Contributor
Well, I don't see how lookup relates to editing values, but the important thing is you're learning how to solve problems by your own means. As you get experience it won't be so surprising. :)

We're here when you need help.

Jim
Sep 3 '13 #4
sashasandy
14 New Member
hehe!! i guess it has had u in surprise also, because it does!
i used a query instead of vba.
see attachment below for any one who might bump into this.
this Thread is SOLVED!
:-)
Attached Files
File Type: zip Grade.Awarding.zip (25.0 KB, 75 views)
Sep 3 '13 #5
zmbd
5,501 Recognized Expert Moderator Expert
Sashasandy:
You are not editing values in the list of the lookup control. This is what you asked for - not what you actually needed, and to confuse matters more, the posted code acts as a red-herring sending us off on some other tangent.

Instead of what you asked and posted code for, what it appears that you needed was to be able to change the value stored in field [Comments]![comment] while limiting it to a known set of values.

If you had clearly asked this question to begin with, we would have had you to that lookup field within a post or two.

BTW: Sashasandy, this is basically the same question you asked in your last thread. How to Customize an IF Function in vba using a form. Although I am flattered that you used the "Select...Case" construct, I would still suggest looking at Seth's solution using the table and ranges. In fact, using the lookup field you can base the values on a table, once again, making it easier to maintain.

jimatqsi:
As I'm sure you've realized by now, what Sashasandy was asking for was a way to change the value in the field [Comments]![comment] using a standard set of values. Replacing the text more than likely with a numeric.

In anycase, what Sashasandy solution is simply, as jimatqsi well knows, a simple lookup-field... one of the more common tools that we use in queries and forms.
Sep 3 '13 #6

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

Similar topics

15
2251
by: Max | last post by:
Hi, I'm a perl programmer and am trying to learn PHP. So far I have figured out most of the differences, but have not been able to find out how to do the following: When running through a...
3
3873
by: Patrice | last post by:
Hi, I need to do multi-conditional statements like below, but this error is displayed : Expected 'End' /myFilepath, line x else response.write(arrCorpo(sparam,sdiv)) end if I don't...
3
1598
by: Sergej Andrejev | last post by:
Not long ago I was asked to give PHP lections to some private IT school. I'm on second lection now, and will be teaching my :) students conditional statements (if..else and switch) and loops (while...
92
9768
by: Raghavendra R A V, CSS India | last post by:
hie.. Do any one knows how to write a C program without using the conditional statements if, for, while, do, switch, goto and even condotional statements ? It would be a great help for me if...
2
1427
by: prasad | last post by:
hai all users i resquesting the conditional statements examples. thaniking you inagaprasdreddy
9
1780
by: horizon5 | last post by:
Hi, my collegues and I recently held a coding style review. All of the code we produced is used in house on a commerical project. One of the minor issues I raised was the common idiom of...
5
1796
by: =?Utf-8?B?Y2FyYm8=?= | last post by:
I am getting odd behavior in my code, first I thought it was caused by SP1 but now I have the same issue with a vanilla version of VS 2005. When I execute a function that contains an if statement....
1
2574
by: Brian | last post by:
I have an ASP.NET page that uses a FormView and SqlDataSource. Within my page I want to change a string if a column within my database record is a certain value. Here is some sample code: ...
8
5251
by: chromis | last post by:
Hi, I'm writing a contacts section for a cms on a website, I've decided to write the section in OO code. So far I have my Contacts object and a page structure I would use for a procedural site. ...
0
7086
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
7280
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
7460
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.