Question about If statements

PRodgers4284

Registered User.
Local time
Today, 14:44
Joined
Feb 17, 2009
Messages
64
I want to know if i have lots of code for eg If statements in the "form current" section of my code will this potential slow down the running of my form, or does it depend on the complexity of the code?
 
Yes, it could potentially slow stuff down. What exactly do you need to test?
 
Yes, it could potentially slow stuff down. What exactly do you need to test?

I have two combo boxes within a form that change based on the selection, the combo boxes are called hospital and ward, within each hospital they are certain wards and only the wards appear within the hospital selected, this works fine using a query with two table (hospital and ward). The problem i have is on a form that allows the user to view the database records which i have locked for viewing only, the data for for the hospital and wards appear with the id numbers from the table, not the hospital and ward name. I was considering using an if statement for each, for example

if hospital = "1" then
hospital = hospital name

This same like a laborious way to do this, is there a way i can do this using a query? I dont have access to my database atm, i would probably need to post it up it properly explain what im talking about.
 
I have two combo boxes within a form that change based on the selection, the combo boxes are called hospital and ward, within each hospital they are certain wards and only the wards appear within the hospital selected, this works fine using a query with two table (hospital and ward). The problem i have is on a form that allows the user to view the database records which i have locked for viewing only, the data for for the hospital and wards appear with the id numbers from the table, not the hospital and ward name. I was considering using an if statement for each, for example

if hospital = "1" then
hospital = hospital name

This same like a laborious way to do this, is there a way i can do this using a query? I dont have access to my database atm, i would probably need to post it up it properly explain what im talking about.

To add the name, just do something like I did in this sample:
(and you can't do things in the form OPEN event for records, you need it in the LOAD event as the OPEN event fires before the records are loaded).
http://downloads.btabdevelopment.com/Samples/combos/Sample-FillInFields.zip
 

Users who are viewing this thread

Back
Top Bottom