Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 11th, 2005, 04:46 PM
asylum asylum is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 3 asylum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 11 m 38 sec
Reputation Power: 0
Unhappy VBA code help

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

Reply With Quote
  #2  
Old June 3rd, 2005, 07:45 AM
sherrington sherrington is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 85 sherrington User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 4 m 52 sec
Reputation Power: 5
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > VBA code help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway