alter properties of subForm control

G

Geof Wyght

Ted,
These replies are making me dizzy.
1) Did you download the db2.mdb the 2nd time?
2) In your mdb did you declare lngBlack?
Geof.
 
G

Guest

1) yes i did
2) ditto

geoff -- i think this software's having an 'issue' with restpect to the fact
that in my own app'n i have all the controls on one subForm; in yours, you
deposited the 'Outcome' control onto the main/parent form and (i guess since)
your fields were unbound (deposited a button onto the main one).

in my app'n (with the lngBlack correction), i have all my controls bound to
a table behind the form with table names that are the same as the controls'
and i have the code in an 'On Event' property.

so when you referenced the Outcome control in your 2nd db, i would guess it
correctly pointed to the fact it was sitting on the main form (your code's
below):

Option Compare Database
Option Explicit

Private Sub Command5_Click()
Dim lngRed As Long
Dim lngYellow As Long
Dim lngWhite As Long
Dim lngBlack As Long
Dim Time_on_List As Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Controls("Screening Log DS View").Form.Controls("Time_on_List") = _
DateDiff("d", Me.Controls("Screening Log DS
View").Form.Controls("Date_on_List"), Now())

If Me.Controls("Screening Log DS View").Form.Controls("Time_on_List") >= _
30 And Me.Outcome = "Pending" Then
Me.Controls("Screening Log DS
View").Form.Controls("Time_on_List").ForeColor = lngYellow
Me.Controls("Screening Log DS
View").Form.Controls("Time_on_List").BackColor = lngRed
Else
Me.Controls("Screening Log DS
View").Form.Controls("Time_on_List").ForeColor = lngBlack
Me.Controls("Screening Log DS
View").Form.Controls("Time_on_List").BackColor = lngWhite
End If

End Sub


SO, when it sees "Me.Outcome = "Pending"" it 'knows' to get if from the same
form the button's on.

this is all reasoned conjecture from a VBA 'newbie' but i am reckoning that
when this code shows up in an 'On Event' property of the subForm we need to
'tell' VBA where the 'Outcome' control's sitting and that it's on the same
subForm as all the other controls.

i'm trying to morph your app'n into a miniature of the full-blown one i am
cobbling together. so, i'm creating a table with three fields which will be
my data source for the bound controls on the sub-form. i'm removing the
Outcome field from the parent form and knocking off the command button. so
far, i still seem to be ticking off the compiler :-(

i'd love to see what happens on your end...

ted
 
G

Guest

geoff,

this is sort of where i started.....

i'd noticed that the code i used (which now is the one i pasted from your
sonofdb2.dmd file) in the On Current event property was having no effect on
the display of the 'Time_on_List' column!! there were no error messages,
that's true, but as i moved the record pointer through the datasheet view
nothing was happening the values of Time_on_List!!??!! so i snooped around
the ms k'base and found 209099 which got me to thinking there were
referential issues requiring satisfactions. the rest as they say is history...

bottom line, i agree, your latest mdb 'works', but the (event with the
pasted code from it in) one i have doesn't.

kinda weird.
 
G

Guest

geoff, i'm sort of really keen to figure this out, and in ruminating through
the sonofdb2.mdb file you sent me, i just noticed you're using a query as the
record source of the subForm's. am i correct? why not the table? could that
explain this?

best,

ted
 
G

Geof Wyght

Ted,
Just a habit. Maybe you want to sort (Order) the data
first or select only some of it with a where clause. Or
join it up with another table to show related fields.
Geof.
Off to dinner & concert in 20 minutes...
 
G

Guest

i'm responding from home (vs office) at this time, so i can't but i'll look
back on it monday.

nice weekend,

ted
 
G

Guest

perhaps you're right, geoff, but did you try more nearly modeling this son..
to the configuration of mine's, which defaults the user into datasheet view.
i just did on yours and no cigar :-( you don't get the conditional
technicolor fx when it's in this mode!! at least, unless there's some blessed
workaround. anyway, why don't you try and see if it doesn't behave any
differently on your desktop next week and give me a shout?

ted
 
T

Ted

Yeah, I wasn't aware of the default data sheet view. I'll
download it and try it.
Geof.
 
G

Guest

i can't believe this software geoff; seems like there just oughta be a better
way, doesn't it. maybe this is heretical on an ms access discussion group,
but did you ever hear of 'FileMaker'? i took a look at their website today
and am considering downloading a 30 day trial version.

ted
 
G

Geof Wyght

Ted,
I see your problem now that the subform is in datasheet
view. That's not your fault. I have a magazine article
somewhere that might describe how to get around that. I
have heard of Filemaker but have never used it.
Geof.
 
G

Guest

geoff,

seems like they oughta have acknowledged that shortcoming in their kb by
know. i will also give ms tech support a ring on monday and bring the problem
to their attention, fwiw.

do you think the article was in one of the Advisor.com's series of
publications; i'm considering a subscription that garners the right to search
their online archives of published articles.

best,

ted
 
G

Guest

geoff,

if you find time to dig through your collection, i'd love to learn how the
w'krnd goes.

with many thanks and best regards,

ted
 
G

Geof Wyght

Ted, Good news & bad news. It's in the July 2003 Access
VB SQl Advisor issue, but it doesn't deal with formating.
I have the issue and the CD by the way. BUT, I tried
conditonal formating on one of the datahseet fileds and
it worked. Conditonal formating is in the form design
view under the View menu. You may have to do your
formating which is dependent on other fields with VBA and
not the dialog box. Give it a try.
Geof.
 
G

Guest

hi geoff,

that'll be good if/when i get a subscription in to the pub'n.

i don't understand what exactly you meant to tell me you tried worked on
which field? i'm aware of cond'l formatting as being univariate, i.e. that
when the cursor is sitting in a control and you invoke the 'Conditional
Formatting' interactor that you can set a condition on that same field which
if true results in some formatting of interest (e.g. when the cursor's in the
'Outcome' field, you could instruct A2K to have the field turn bright red
bckgrnd w/ yellow text if "Pending" is found to be the value in the field).
your response seemed to raise more questions than it answered for me. you
mentioned having to "do your
formating which is dependent on other fields with VBA and
not the dialog box" which (correct me if i'm wrong) was what we spent the bulk of yesterday doing successfully until we ran into the "Datasheet exception" as i call it.

best,

ted
 
G

Geof Wyght

Ted,
I uploaded d33.mdb to http://home.fuse.net/Wyght/db3.mdb.
I put 2 conditional formats on the Time_on_list control.
But they seem to be Or conditons not And conditions. I
wonder if you can be more flexible with VBA? I tried
conditonal formating with VBA for a few minutes but
couldn't get the syntax right.
Geof.
-----Original Message-----
hi geoff,

that'll be good if/when i get a subscription in to the pub'n.

i don't understand what exactly you meant to tell me you tried worked on
which field? i'm aware of cond'l formatting as being univariate, i.e. that
when the cursor is sitting in a control and you invoke the 'Conditional
Formatting' interactor that you can set a condition on that same field which
if true results in some formatting of interest (e.g. when the cursor's in the
'Outcome' field, you could instruct A2K to have the field turn bright red
bckgrnd w/ yellow text if "Pending" is found to be the value in the field).
your response seemed to raise more questions than it answered for me. you
mentioned having to "do your
was what we spent the bulk of yesterday doing
successfully until we ran into the "Datasheet exception"
as i call it.
 
G

Guest

geoff i looked at what you did in the conditional formatting part (for
'Time_on_List') and wonder if it wouldn't be technically possible to 'fuse'
both conditions (the requirement that "pending" be true for "Outcome"
together with TOL's being te 30) into just one instead of divvying 'em up
like that. i will probably try that out tomorrow.

i also checked out your modified VBA and the 'alien' syntax (for a relative
'newbie') such as i piqued my interest, (referring to below)

'I tried this for about 5 minutes but couldn't get the syntax right.

'me.Outcome.FormatConditions.Add(type:=acExpression,operator:=acEqual,expression1="=30")

also on my 2do list for tomorrow.

heap of thanks for all the bandwidth. will get back 2u tomorrow.

with warmest regards,

ted
 
G

Geof Wyght

Ted,
Well, that is the question: can we form And-type
conditions instead of Or-type conditions?
Geof.
PS: Let's start a new thread.
 

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