473,396 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

2nd Try: Access Data in Subform

I tried to ask this a few days ago: I was then thinking in terms of
using a parameter query--I've since decided that that was not a good
approach.

I have a form that displays information on 'colorsets': setname,
number of colors (limited to >=3, <=11) in set, settype. The form
displays this for one set at a time, but the user can scroll through
all the available colorsets.
The form is in a one-to-many relationship with a subform that
displays, for each color in the colorset:

setname sequenceNo Red Green Blue

(I think that this is a datasheet view: each field is defined as a
separate text box; the parent form contains a subform whose space
contains the whole table of colors)

Under this table of colors sit 11 rectangles. The first n=number in
set,
should show the colors defined by the table's red,green,blue values w/
the rest defaulting to 'white'. I can see on the screen the red,green,
blue values for each color in the set, but I don't know how to access
them in code from what the subform already knows. I posted a few days
ago thinking to use a parameter query for this, but I've been unable
to get that going and I've decided that it has to be easier than that
anyway--after all the subform has already found all those numbers--so
how do I pick them up for use in my own code?
I want to say

ClrRect(j).background = RGB(red,green,blue)

so I need red,green,blue for each color in the set
whenever the colorset in the parent form changes. How can I find these
values?
thanks, --thelma
Nov 13 '05 #1
6 1567
I'm not sure if this answers your question. This converts Access long
colours to an RGB !!!string!!! (so to speak). Bear in mind that it's an
old function written by an old man late at night!

Public Function RGBString(ByVal colour As Long) As String
RGBString = CStr(colour And 2 ^ 8 - 1) & "," _
& CStr(colour And 2 ^ 16 - 1) \ (2 ^ 8) & "," _
& CStr(colour And 2 ^ 24 - 1) \ (2 ^ 16)
End Function

Sub test()
Debug.Print RGBString(13408767)
' shows 255,153,204
End Sub
Nov 13 '05 #2
Lyle Fairfield <ly***********@aim.com> wrote:
: I'm not sure if this answers your question. This converts Access long
: colours to an RGB !!!string!!! (so to speak). Bear in mind that it's an
: old function written by an old man late at night!

: Public Function RGBString(ByVal colour As Long) As String
: RGBString = CStr(colour And 2 ^ 8 - 1) & "," _
: & CStr(colour And 2 ^ 16 - 1) \ (2 ^ 8) & "," _
: & CStr(colour And 2 ^ 24 - 1) \ (2 ^ 16)
: End Function

: Sub test()
: Debug.Print RGBString(13408767)
: ' shows 255,153,204
: End Sub

I'm afraid that you've just confirmed what my husband keeps telling me:
I can't explain *anything*.

No, I'm not looking for an algorithm to do the color conversion.
What I can't figure out is how I can programmatically access the
the red,green,blue *numbers* shown for each color.

Example:

Form shows:

COLORSETNAME NUMBERofCOLORSinSET SETTYPE
thelma6 6 neutral

Subform shows:

COLORSETNAME SEQUENCENO RED GREEN BLUE
thelma6 1 111 43 2
thelma6 2 44 16 79
thelma6 3 222 100 4
thelma6 4 9 10 11
thelma6 5 99 27 112
thelma6 6 71 14 143

I have an RGB function; what I don't know how to
get in code are the red, green, blue values shown for
a SEQUENCENO e.g.

ClrRect(4).background = RGB(red4,green4,blue4) i.e.
ClrRect(4).background = RGB( 9, 10, 11)

The table's red, green, blue cells are shown in the design
view of the subform as textboxes named RED, GREEN, BLUE
so I can say:

ClrRect(1).background = RGB(RED.value,GREEN.value,BLUE.value)

and it colors rectangle 1. But I don't know how to get to
the numbers beyond row 1 of that table.

thanks, --thelma
Nov 13 '05 #3
Have you considered walking the recordsetclone of your subform
....something like:
With Me.RecordsetClone
b = .Bookmark
.MoveFirst
Do While Not .EOF
Debug.Print .Fields("Red").Value & "," _
& .Fields("Green").Value & "," _
& .Fields("Blue").Value
.MoveNext
Loop
.Bookmark = b
End With

Of course, if calling from main form one would need an appropriate
replacement for Me.

Nov 13 '05 #4
lylefair <ly***********@aim.com> wrote:
: Have you considered walking the recordsetclone of your subform
: ...something like:
: With Me.RecordsetClone
: b = .Bookmark
: .MoveFirst
: Do While Not .EOF
: Debug.Print .Fields("Red").Value & "," _
: & .Fields("Green").Value & "," _
: & .Fields("Blue").Value
: .MoveNext
: Loop
: .Bookmark = b
: End With

Thank you. That's perfect. I cut it and pasted it into my
subroutine, changed the field names to all capitals, replaced
the debug.print with my code for rectangle coloring and it
works.

Now, not to appear too perfect, my next problem is that I'm
trying to put my 11 rectangles into an array, but whatever I
define it as seems to annoy VBA. I've tried to dimension it
access object, Rectangle, variant, but when I say e.g.

RAray(1).backcolor = 111 it complains

Unfortunately, I don't remember its specific complaints.

--thelma

: Of course, if calling from main form one would need an appropriate
: replacement for Me.

Nov 13 '05 #5
Air Code:
' modular scope
Dim rArray(2) As Control

Private Sub Command12_Click()
rArray(1).BackColor = RGB(255, 0, 0)
End Sub

Private Sub Form_Open(Cancel As Integer)
Set rArray(0) = Me.Box13
Set rArray(1) = Me.Box14
End Sub

Nov 13 '05 #6
lylefair <ly***********@aim.com> wrote:
: Air Code:
: ' modular scope
: Dim rArray(2) As Control

: Private Sub Command12_Click()
: rArray(1).BackColor = RGB(255, 0, 0)
: End Sub

: Private Sub Form_Open(Cancel As Integer)
: Set rArray(0) = Me.Box13
: Set rArray(1) = Me.Box14

ah, it's this word 'Set' that stopped me. I finally found this
way of 'Set'ting the Control variable via Google yesterday.
Microsoft's own documentation produced a dizzying selection of
articles, none of the first 20 or so relevant. But I've been
unable to find documentation for the Set command itself.

Why do I need to
Set controlVar = someControl
instead of what I tried to do
controlVar = someControl

thank you again for your tireless help.
--thelma
: End Sub

Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Simon | last post by:
Hello All I am trying to build a couple of forms in Access 2000. Whilst I have one form which has all of the contact details in it also generates (using autonumber) a unique id for the customer....
7
by: Julia Baresch | last post by:
Hi everyone, My company recently upgraded from Office 97 to Office XP. As those who've read my other posts know I have a database with 3 nested subforms Main form-->First Subform-->Second...
0
by: Josh C. | last post by:
Hello everyone. I'm a bit of an Access newbie, so please bear with me. Please go to http://www.dumoti.com/access/ to view the database - 536kb. I'll go straight into examples: In the form...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
1
by: Terry | last post by:
Hello, Has anyone experienced the following problem following an Upsize from Access 97 to SQL 2000 using the MS Upsize Wizard? Or can anyone see what the problem might be. Before Upsize...
12
by: Wadim Grasza | last post by:
I want to store and display (on a form or a report) multiple pictures per record in an access database. The pictures are not stored within the database. They are stored as files and the database...
22
by: Deano | last post by:
Hi, I have a finished Microsoft Access app that we are distributing using an Access runtime. This works fine (mostly) but I'm sold on the advantages of dot.NET and upgrading to vb.NET seems...
20
by: TC | last post by:
I need an automated procedure to copy data from an Access table to a SQL Server table. Speed is important. What is the recommended technique? I can export the data from Access, copy it via FTP,...
1
by: ashkash | last post by:
I have an access database which takes information from a user and then uses the mail merge functionality to merge the data into a word document. I have a lot of subforms in the access database which...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.