473,385 Members | 1,875 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,385 software developers and data experts.

Access Form

75
Have a question about Access form.

Total Dose (TextBox)
Total Dose Unit (Combobox) (mg,mcg)
Total Volume (TextBox)
Final Dose (TextBox)
Final concentration (Combobox) (mg.mcg)

What I want to do is to divide TotalDose/ Total volume to get Final dose. but in order to get the final concentration, WE have to see what is the Total dose Unit is? if its mcg, multiply the final dose by 1000 or if its mg multiply by 1.
Here is the code I have, but its not working.

Expand|Select|Wrap|Line Numbers
  1.  
  2. End SubPrivate Sub Total_Dose_Unit_AfterUpdate()
  3.  
  4. If TotalDoseUnit = "mcg" Then
  5. Me.Final_Dose_ml = (Me.Total_Dose / Me.Total_Volume) * 1000
  6. Else
  7. Me.Final_Dose_ml = (Me.Total_Dose / Me.Total_Volume)
  8.  
  9. End If
  10.  
  11. End Sub 
Expand|Select|Wrap|Line Numbers
  1. Private Sub Total_Dose_Change()
  2. If TotalDoseUnit = "mcg" Then
  3. Me.Final_Dose_ml = (Me.Total_Dose / Me.Total_Volume) * 1000
  4.  
  5. Else
  6. Me.Final_Dose_ml = (Me.Total_Dose / Me.Total_Volume)
  7.  
  8. End If
  9.  
  10. End Sub
  11.  
I have the same code under
Expand|Select|Wrap|Line Numbers
  1.  Private Sub Total_Dose_LostFocus()
Expand|Select|Wrap|Line Numbers
  1.  Private Sub Total_Volume_ml_Change()
Expand|Select|Wrap|Line Numbers
  1.  Private Sub Total_Volume_ml_LostFocus()
Any help would be really appreciated.
Jul 5 '07 #1
4 1513
puppydogbuddy
1,923 Expert 1GB
Have a question about Access form.

Total Dose (TextBox)
Total Dose Unit (Combobox) (mg,mcg)
Total Volume (TextBox)
Final Dose (TextBox)
Final concentration (Combobox) (mg.mcg)

What I want to do is to divide TotalDose/ Total volume to get Final dose. but in order to get the final concentration, WE have to see what is the Total dose Unit is? if its mcg, multiply the final dose by 1000 or if its mg multiply by 1.
Here is the code I have, but its not working.

Expand|Select|Wrap|Line Numbers
  1.  
  2. End SubPrivate Sub Total_Dose_Unit_AfterUpdate()
  3.  
  4. If TotalDoseUnit = "mcg" Then
  5. Me.Final_Dose_ml = (Me.Total_Dose / Me.Total_Volume) * 1000
  6. Else
  7. Me.Final_Dose_ml = (Me.Total_Dose / Me.Total_Volume)
  8.  
  9. End If
  10.  
  11. End Sub 
Expand|Select|Wrap|Line Numbers
  1. Private Sub Total_Dose_Change()
  2. If TotalDoseUnit = "mcg" Then
  3. Me.Final_Dose_ml = (Me.Total_Dose / Me.Total_Volume) * 1000
  4.  
  5. Else
  6. Me.Final_Dose_ml = (Me.Total_Dose / Me.Total_Volume)
  7.  
  8. End If
  9.  
  10. End Sub
  11.  
I have the same code under
Expand|Select|Wrap|Line Numbers
  1.  Private Sub Total_Dose_LostFocus()
Expand|Select|Wrap|Line Numbers
  1.  Private Sub Total_Volume_ml_Change()
Expand|Select|Wrap|Line Numbers
  1.  Private Sub Total_Volume_ml_LostFocus()
Any help would be really appreciated.

The following code should work if the correct names of your objects are used. Which is correct? Total_Dose_Unit or TotalDoseUnit? Final_Dose_ml or Final Dose? Total Volume or Total_Volume? Total Dose or Total_Dose? You should avoid spaces in the names for your objects, but if you do have spaces, you must enclose the names in brackets.

Expand|Select|Wrap|Line Numbers
  1. Private Sub [Total Dose Unit]_AfterUpdate()
  2.  
  3. If [Total Dose Unit].Value = "mcg" Then
  4. Me![Final Dose].Value = (Me![Total Dose].Value / Me![Total Volume].Value) * 1000
  5. Else
  6. Me![Final Dose].Value = (Me![Total Dose].Value / Me![Total Volume].Value)
  7.  
  8. End If
  9.  
  10. End Sub
  11.  
Jul 5 '07 #2
pukhton
75
Thanks for your response.
I think some how I got that thing to work. But i have a lillte slide problem.
On my form I have Medication combo box, which has list of medication and standrard concentration for each medication, that is workign fine, but
There are 2 medications " Fentanyl" and "Remifentanil" and they are always in mcg. so when user picks the above 2 medications, i want to show the FinalConcentration units in mcg rather than in mg.

For example : total dose = 2500mcg
Total Volume= 50ml
If you do the math you should get 50 mg or 50000 mcg. but I want 50 mcg for this. I am not sure If I have clear it up or not? please let me know, if you need more info on it.
Jul 5 '07 #3
puppydogbuddy
1,923 Expert 1GB
Thanks for your response.
I think some how I got that thing to work. But i have a lillte slide problem.
On my form I have Medication combo box, which has list of medication and standrard concentration for each medication, that is workign fine, but
There are 2 medications " Fentanyl" and "Remifentanil" and they are always in mcg. so when user picks the above 2 medications, i want to show the FinalConcentration units in mcg rather than in mg.

For example : total dose = 2500mcg
Total Volume= 50ml
If you do the math you should get 50 mg or 50000 mcg. but I want 50 mcg for this. I am not sure If I have clear it up or not? please let me know, if you need more info on it.
Something like this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub [Total Dose Unit]_AfterUpdate()
  2.  
  3. If [Total Dose Unit].Value = "mcg" And (Me!Medicine_Name = "Fentanyl" Or Me!Medicine_Name = "Remifentanil”) Then
  4.      Me![Final Dose].Value = (Me![Total Dose].Value / Me![Total Volume].Value)
  5. End If
  6. If [Total Dose Unit].Value = "mcg" And (Me!Medicine_Name <> "Fentanyl" And Me!Medicine_Name <> "Remifentanil”) Then
  7.      Me![Final Dose].Value = (Me![Total Dose].Value / Me![Total Volume].Value) * 1000
  8. Else
  9.      Me![Final Dose].Value = (Me![Total Dose].Value / Me![Total Volume].Value)
  10.  
  11. End If
  12.  
  13. End Sub
  14.  
Jul 5 '07 #4
pukhton
75
Something like this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub [Total Dose Unit]_AfterUpdate()
  2.  
  3. If [Total Dose Unit].Value = "mcg" And (Me!Medicine_Name = "Fentanyl" Or Me!Medicine_Name = "Remifentanil”) Then
  4.      Me![Final Dose].Value = (Me![Total Dose].Value / Me![Total Volume].Value)
  5. End If
  6. If [Total Dose Unit].Value = "mcg" And (Me!Medicine_Name <> "Fentanyl" And Me!Medicine_Name <> "Remifentanil”) Then
  7.      Me![Final Dose].Value = (Me![Total Dose].Value / Me![Total Volume].Value) * 1000
  8. Else
  9.      Me![Final Dose].Value = (Me![Total Dose].Value / Me![Total Volume].Value)
  10.  
  11. End If
  12.  
  13. End Sub
  14.  
GOT IT THANKS.... HAVE A GOOD DAY
Jul 5 '07 #5

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

Similar topics

6
by: Hamed | last post by:
Hello I have employed as a developer in a software company that its team uses FoxPro / VB 6.0 / VC++ 6.0 as the developing tools and newly is going to migrate to VS.NET. There is a project...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
20
by: Olav.NET | last post by:
I am a .NET/C++ developer who is supposed to do some work with Access. I do not know much about it except for the DB part. Questions: *1* I am looking for INTENSIVE books to get quickly up to...
9
by: prakashwadhwani | last post by:
Hi !! I'm about to develop a new project for a client. Should I go about it in Access 2003 or 2007 ? Purchasing it either for me or for my client is not a major consideration here ... what I'd...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.