|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
Need to convert the value in and access db query to another value for printing
I have a field in my db called "Gender" it can have values "Male" or "Female". I will be printing this information onto a pre-printed form which has cross-boxes/check-boxes for male and female. I have created fields in a query called "MaleX" and "FemaleX". These fields contain the same value as gender. I need two functions. In the "MaleX" field it will convert the value in the Field to an "X", if the value is "Male" else it will convert it to a null. In the "FemaleX" field it will convert the value in the Field to an "X", if the value is "Female" else it will convert it to a null.
I know this sounds easy but when I can get the value into the field. In the query, I have the fields as "FemaleX: convertFemale([Gender])" and "MaleX: convertMale([Gender])" The code I tried doesn't work but probably explains the problem better than I have " Public Function convertFemale(strInput As String) If (strInput = "Female") Then strInput = "X" Else strInput = null End If End Function " Hope someone can help I really don't know very much about vb |
|
#2
|
|||
|
|||
|
Rather than using an additional VB function, I used the IIf statement, which evaluates a condition and returns a value depending on whether the condition is true or false.
I changed the calculated fields in your query to: FemaleX: IIf([Gender]="Female","X","") MaleX: IIf([Gender]="Male","X","") That did it |
| Viewing: Dev Shed Forums > Databases > Database Management > Need to convert the value in and access db query to another value for printing |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|