Hi all,
How do you show a value that is generated on the fly (not stored in a table) in a column in a subform? The value is generated in a function:
It returns either letters A-Z or numbers 01, 02, 03...10, 11, 12, etc.
So if the user enters that there are 3 apartments (intHowManyApartments) on Floors 3 - 4 and the apartments are letter designated, I want the subform to output:
Floor Apt
3 A
3 B
3 C
4 A
4 B
4 C
where the values in Apt are from the function.
I get all the correct values for apt just fine (debug.print to immediate window) but don't know how to show them in the subform.
Is there a way to do this or am I going about this entirely the wrong way?
As always, thank you tek-tipsters!
Vie
How do you show a value that is generated on the fly (not stored in a table) in a column in a subform? The value is generated in a function:
Code:
Public Function GetApartmentDesignation()
Dim intOption As Integer
Dim i As Integer
Dim strApt As String
intOption = Forms!frmProjectApartments.oleApartmentDesignation
Select Case intOption
Case 1 'Apartments are designated by letter
For i = 1 To intHowManyApartments
strApt = i + 64
GetApartmentDesignation = Chr(strApt)
Next i
Case 2 'Apartments are designated numerically
For i = 1 To intHowManyApartments
If intHowManyApartments < 10 Then
strApt = "0" & i
GetApartmentDesignation = strApt
Else
strApt = i
GetApartmentDesignation = strApt
End If
Next i
End Select
End Function
It returns either letters A-Z or numbers 01, 02, 03...10, 11, 12, etc.
So if the user enters that there are 3 apartments (intHowManyApartments) on Floors 3 - 4 and the apartments are letter designated, I want the subform to output:
Floor Apt
3 A
3 B
3 C
4 A
4 B
4 C
where the values in Apt are from the function.
I get all the correct values for apt just fine (debug.print to immediate window) but don't know how to show them in the subform.
Is there a way to do this or am I going about this entirely the wrong way?
As always, thank you tek-tipsters!
Vie