Filling in a grid of text boxes using nested loops?

T

tjandt

I wasn't sure whether to post this here or in the programming forum
but here goes.

I've been working on a problem to try and plot values into an array o
text boxes, and am really stuck. I'm hoping some guru out there is u
for the challenge on this one, as it seems beyond me

I have a 'lakes' table with the following fields:
*Lake Name
Lake Size
Lake State
Lake Image

I have a 'fish types' table that has the following fields:
*Fish Type
Fish Abbreviation

I have a 'caught' table that has the following fields:
Fish Type
Lake Name
Caught X Coord
Caught Y Coord

* - Primary Key

I have one to many relationships with referential integrity set fro
the Lakes and Fish tables to the Caught table using the Lake Name an
Fish Type fields accordingly.

I have a form based on the Lakes table that has the image of the lak
with X and Y coordinates on it.

So the image would look like this (where the X's are unbound tex
boxes).

A B C D
[------------------]
1 | xx xx xx xx |
2 | xx xx xx xx |
3 | xx xx xx xx |
4 | xx xx xx xx |
[------------------]

Also on the form, i have two combo boxes that display a list of uniqu
values for all the fish types caught on that lake and a button tha
says 'Plot'

What I'd like to do is as follows:

If user selects fish from first combo box, the text boxes on the lef
fill with the fish abbreviation of the fish caught in that location
(example: If user selects sunfish and I caught a Sunfish (S) at C3
the the first text box on C3 would populate with the letter S)

If user selects fish from the second combo box, the text boxes on th
right fill with the fish abbreviation of the fish caught in tha
location
(example: If user selects Bass and I caught a Bass (B) at A1, the th
right text box on A1 would populate with the letter B)

If user selects fish from both combo boxes, the text boxes on the lef
fill from combo box one, and the text boxes on the right fill fro
combo box two.
(example: If user selects sunfish and I caught a Sunfish (S) at C3
the the first text box on C3 would populate with the letter S and I
user selects Bass and I caught a Bass (B) at A1, the the right tex
box on A1 would populate with the letter B.)

Finally, I'd like to add color coordination to this so that if th
count of a fish at a coordinate exceeds a certain limit, the color o
the letter would change at that location.
(Example: If I caught 1-5 bass at a location, text would be black
6-10, text would be yellow, 11-20, text would be orange, and over 20
text would be red)

The text boxes are currently named txtA1, A1-2, txtB1, txtB1-2, etc
for the left and right box at each coordinate respectively.

I am not hugely skilled at programming, and from what a co-worker an
I came up with, think this needs some kind of advanced query, mixe
with some nested loops of code.

Can anyone out there lend a hand on this? It would be hugel
appreciated! I'd be happy to e-mail you a sample database with sampl
data if you think you could tackle it. I am leaving on a fishing tri
this coming weekend, and was really hoping to have it done by then

Thanks in advance,
Ti
 
T

Tim Ferguson

(e-mail address removed)-spam.invalid (tjandt) wrote in
I am not hugely skilled at programming, and from what a co-worker and
I came up with, think this needs some kind of advanced query, mixed
with some nested loops of code.

Don't know so much about the advanced query, but you are requesting some
pretty fancy GUI programming. I would consider moving out of Access for
the GUI because the available controls would take a lot of mangling.

Excel is clearly well-built for any kind of row-and-column grid stuff.
It's quite easy to manipulate the cell colours according to their values,
either in code or using conditional formatting.

VB proper lets you create arrays of controls, so that you can access them
much more neatly than in Access.

Don't despair about the work you have done already: the database access
is exactly the same as what you already have (i.e. using ADO or DAO) and
the VB language itself is practically the same.
Can anyone out there lend a hand on this? It would be hugely
appreciated! I'd be happy to e-mail you a sample database with sample
data if you think you could tackle it. I am leaving on a fishing trip
this coming weekend, and was really hoping to have it done by then

From what you have described, I would guess it's more than an afternoon's
gentle coding. Best of luck -- take a laptop and finish it while waiting
for the bites!

HTH


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top