Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Grid design for controls in form

Posted on 2000-02-13
4
Medium Priority
?
261 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 600 total points
ID: 2553868
Locking to get some attention!

Please reject and review comments.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

926 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