|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a small problem. I have a form with tick boxes. Each one is named as follows 1.1,1.2,1.3,1.4,1.5,1.6. I wish to if the box is that is has the value true add it to a string field in my table called str when I press a button. It has been suggested that I do this using a loop and a case statement. So in case 1 if 1.1 = "true" then added 1.1 to str. However I do not code vba and while the sudo code makes sense I cannot seem to figure out how to get it to work. Any help greatly appreciated.
Thanks Asylum |
|
#2
|
|||
|
|||
|
Paste the following code into the code window of your form and refer to SetCheckString whenever you need to set the value.
public function SetCheckString() Dim i As Integer Dim FldName As String ' change strString to the name of the field for output strString = "" For i = 1 To 6 FldName = "1." & i If Not IsNull(Me.Form(FldName)) Then If Me.Form(FldName) Then strString = strString & FldName Next i End function |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > VBA code help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|