Solved

Grid design for controls in form

Posted on 2000-02-13
4
201 Views
Last Modified: 2012-06-21
I am trying to design a form where I have controls in a grid design 30 X 30 on a form, with all the controls unbound.  The idea is that users will be able to click on controls on the form and change the foreground and background colours with the aim of easily allowing users to graphically show where items are stored in a storage area.  I have created a details form with colour coding for each item selected by the user and can tranfer this information using code. However, I cannot workout how to store the info for each control and make the grid work short of making a separate table for each control in the grid and using subforms. Any ideas?
0
Comment
Question by:muscats
  • 3
4 Comments
 
LVL 6

Expert Comment

by:simonbennett
ID: 2518396
Im not convinced I get this. Are you wanting to graphically represent data using text boxes, and store this?

From what you are saying you will have a 'grid' of 30 by 30 textboxes. When clicked upon, you want the colour(s) to change. You also want the user to be able to close the form, exit the app, and when the return to have the form in the same state?

Thanks

Simon
0
 
LVL 6

Expert Comment

by:simonbennett
ID: 2518426
Whoops...

If so, then try this. Create a table like this called tblState

ID(int) ForeColour (long) Backcolour (long)
0       0                 256
1       8                 256
2       128               1024

Make your controls into a control array (called txtDisplay for eg) for ease of use. When opening the form, you can refer to each element in the array with the ID field in the new table. e.g.

with tblState
   Do while not .Eof
      Me.txtDisplay(![ID]).forecolor = ![Forecolor]
      Me.txtDisplay(![ID]).backcolor = ![backcolor]
      .movenext
   loop
end with

To save, when exiting the form just reverse the process like

For intLoopCount = 0 to 29

   set rstSave = currentdb.openrecordset("Select * From tblState Where ID = " & trim(str(intloopcount)),dbopendynaset)

   if rstsave.recordcount > 0 then

      rstsave.edit
      rstsave![ForeColor]=me.txtdisplay(intloopcount).forecolor
      rstsave![BackColor]=me.txtdisplay(intloopcount).backcolor
      rstsave.update

   end if

   rstsave.close

next intloopcount

HTH

Simon
0
 

Expert Comment

by:MIDA
ID: 2520436
If you have a stable design, you could try a solution like this:
create a user type to represent each of your button, and either make a table containing all your buttons data ( but take care of the limit on the nuimber of fields in a table) or better, make a master detail design with a table for the total store, and a table linked by a foreign key to the previous one, rerpesenting one button per record or a row of buttons (30) per record. Then you can choose to represent it as a single form with a query joining all the info, or as a master detail form...
0
 
LVL 6

Accepted Solution

by:
simonbennett earned 200 total points
ID: 2553868
Locking to get some attention!

Please reject and review comments.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now