Applefritter
Registered User.
- Local time
- Today, 03:15
- Joined
- Jul 22, 2004
- Messages
- 14
I'm new to Access and know very little about VBA so please bear with me. I have a form (formProfile) which contains a field for (Temperature). Now associated with this form is a subform (formNPF). In this subform is a textbox (TCF) which will automatically populate with a certain value based on the Temperature value in the main form. If Temperature is Between 23.6 and 24.15 my TCF value should be 1.03. If Temperature is Between 24.16 and 24.7, my TCF value should be 1.02, etc...
I started to write some code for this but I'm not sure if I'm doing this correctly or where the code should go. Should I associate the code with an event such as "On Open"? Should the code be in the module associated with my mainform or my subform? Here's what I have so far:
Option Compare Database
Select Case ???
Case 23.6 To 24.15
Me.txtTCF = 1.03
Case 24.16 To 24.7
Me.txtTCF = 1.02
Case 24.71 To 25.30
Me.txtTCF = 1
Case 25.31 To 25.85
Me.txtTCF = 0.99
Case 25.86 To 26.40
Me.txtTCF = 0.98
Case 26.41 To 26.95
Me.txtTCF = 0.96
Case 26.96 To 27.50
Me.txtTCF = 0.95
Case 27.51 To 28.05
Me txtTCF = 0.94
End Select
I started to write some code for this but I'm not sure if I'm doing this correctly or where the code should go. Should I associate the code with an event such as "On Open"? Should the code be in the module associated with my mainform or my subform? Here's what I have so far:
Option Compare Database
Select Case ???
Case 23.6 To 24.15
Me.txtTCF = 1.03
Case 24.16 To 24.7
Me.txtTCF = 1.02
Case 24.71 To 25.30
Me.txtTCF = 1
Case 25.31 To 25.85
Me.txtTCF = 0.99
Case 25.86 To 26.40
Me.txtTCF = 0.98
Case 26.41 To 26.95
Me.txtTCF = 0.96
Case 26.96 To 27.50
Me.txtTCF = 0.95
Case 27.51 To 28.05
Me txtTCF = 0.94
End Select