473,748 Members | 2,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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).back ground = RGB(red,green,b lue)

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 1578
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(13408 767)
' 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(13408 767)
: ' 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 programmaticall y access the
the red,green,blue *numbers* shown for each color.

Example:

Form shows:

COLORSETNAME NUMBERofCOLORSi nSET 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).back ground = RGB(red4,green4 ,blue4) i.e.
ClrRect(4).back ground = 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).back ground = RGB(RED.value,G REEN.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.RecordsetClo ne
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.RecordsetClo ne
: 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).backco lor = 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).BackC olor = RGB(255, 0, 0)
End Sub

Private Sub Form_Open(Cance l 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).BackC olor = RGB(255, 0, 0)
: End Sub

: Private Sub Form_Open(Cance l 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
3738
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. I have also created a button to open up another form which looks at a second table. I want the ID automatically populated into the form (tables are designed one to many) so that correspondence can be added. At the moment access states that...
7
1681
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 Subform First subform is a subform of Main Form, and Second Subform is a subform of First Subform.
0
1584
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 NIGO_ITEM, you'll notice a subform to the NIGO_REASONS table. It won't let any data be entered into this subform and it gives the error: You cannot add or change a record because a related record is required in table CUSTOMER_TABLE. (Error 3201) This...
49
14350
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 application is relatively big: around 200 tables, 200 forms and sub-forms, 150 queries and 150 repports, 5GB of data (SQL Server 2000), 40 users. I'm wondering what are the disadvantages of using Access as front-end? Other that it's not...
1
2078
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 (Access 97 front end and Access 97 tables): A MainForm loads up correctly and then I enter a ReferenceNumber value in a MainForm field control. I then click on the first field of a SubForm, the ReferenceNumber then shows at the top of the SubForm and...
12
20932
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 contains the paths to the pictures. The database consists of two tables: TABLE DATA ID Name LastName
22
2225
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 like a good idea for the future. I'm also keen to develop new software in vb.NET as soon as possible. I will work out how to port the app and how to use ado.NET etc, however I'm not certain about all the things I need to consider hence the...
20
37895
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, then import it into SQL Server. I've tried that, and the speed is acceptable. It is an ugly solution, however, and I expect to find a better one -- preferably a solution better integrated with the Access RDBMS. I've tried using an ODBC...
1
4911
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 allows the user to keep entering data if they need to. By this I mean each subform is like a dynamic table (continous form view) and the user can keep entering data if needed. For example, one of the subforms asks the user to enter the names of...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9370
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8242
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.