Help with form and code

MadMaxx

.NET foo
Local time
Today, 16:19
Joined
Jun 27, 2003
Messages
138
Hello,

I have a form with various fields. I have it laid out like a chart. Also I want the field to be invisible if there is no value located in the query with that number. Here is my code to help you out.

Code:
sqlPart = "SELECT * FROM tblParts WHERE Area='" & PArea & "' AND [Page]='" & PPage & "'"
   Set rsPart = db.OpenRecordset(sqlPart, dbReadOnly)
   
   count = 1
   
   If Not rsPart.EOF And Not rsPart.BOF Then
      Do While Not rsPart.EOF
         ppart(count) = rsPart("partname")
         pcapa(count) = rsPart("Capability")
         count = count + 1
         rsPart.MoveNext
      Loop
   End If
   
   Dim cnt
   For cnt = 1 To 16
      If Not IsNull(ppart(cnt)) Then
         Me("pd" & cnt).Value = ppart(cnt)
         Me("pd" & cnt).Visible = True
         Me("cp" & cnt).Value = pcapa(cnt)
         Me("cp" & cnt).Visible = True
         Me("nd" & cnt).Visible = True
         Me("ad" & cnt).Visible = True
         Me("hd" & cnt).Visible = True
      End If
   Next cnt
   rsPart.Close

Everything works fine except that when it loads the fields that have no values are still visible. Any ideas??

cheers
 
I think you have to use the syntax:

Me.controls("hd" & cnt).Visible = True etc
 
using the me.controls does the same thing. Boxes are still showing when they have no value.
 

Users who are viewing this thread

Back
Top Bottom