Solved

Grid design for controls in form

Posted on 2000-02-13
4
190 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

706 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

18 Experts available now in Live!

Get 1:1 Help Now