[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

datasheet - question 9 - datasheet as a subform

Posted on 2009-04-22
19
Medium Priority
?
353 Views
Last Modified: 2012-05-06
Hi EE,

a) Background:
==========
I have a datasheet as a subform, that is not connected by a key to the parent form.
On the parent form on have a control called: Notes
When the entire form open, the datasheet is displayed AND the Notes field is HIDDEN.

b) I would like:
   when user clicks on a row in a datasheet,
           to SHOW the Notes field with additional info for that row.

c) I created an event for the Subform's detail section: click event

Private Sub Detail_Click()

Me!txtName.Visible = True
Me!lblNotes.Visible = True
Me!txtNotes.Visible = True

End Sub

d) I set a breakpoint in the above event, BUT the event is not firing when I click on a row
in the datasheet.

Any advice, pls, tx, sandra
0
Comment
Question by:mytfein
  • 11
  • 6
17 Comments
 
LVL 75
ID: 24209931
Try clicking on a Record Selector (far left) and see if it works?

mx
0
 

Author Comment

by:mytfein
ID: 24214721
good morning,

mx, tried your idea, click event did not fire... sigh...

tx, s
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 24217082
Try moving to the On Current event:


Private Sub Form_Current ()

Me!txtName.Visible = True
Me!lblNotes.Visible = True
Me!txtNotes.Visible = True

End Sub
0
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 

Author Comment

by:mytfein
ID: 24218223
Hi mx,
It's a nice idea.
I put it on the subform's On Current Event.

When I clicked to change from design to form view:
   The On Current event fired about 3 times
        wonder why? i wish it would not fire at all, unless user clicked on the row

On another post, you provided this link:
http://www.lebans.com/conditionalformatting.htm

It says he is providing logic for current row for datasheet view.
So maybe your idea is possible, but am missing something...

maybe it's time for me to dig into his mdb... '
have you used his technique, if so, perhaps your code can fastpath me towards this goal?
tx, s

0
 

Author Comment

by:mytfein
ID: 24219948
hi mx,
i'm experimenting with the on current for datasheet form in:

http://www.lebans.com/conditionalformatting.htm

i have casual knowledge of custom classes.
i think i followed instructions, but it is not working for me.

do you have experience with this, i'll pick it up again tommorrow, be well, tx, s

0
 
LVL 75
ID: 24220031
I have tried Steven's CF row highlite ... and it works, but seemed to be a bit slow in refreshing for some cases.  It's been a while.

But, lets back up.  We are dealing with a notes field on the Main form, right?  And when the user click in a row on the datasheet, you want to see the Notes for that row ... on the Main form ?  Guess I'm not quite sure what you need here.  

The Leban's app isn't directly related to this as far as I can tell ... ?

mx
0
 

Author Comment

by:mytfein
ID: 24224762
hi mx,

yes you are right - just want to display the Notes field on main form, when user click's on row

i just thought, if i could understand Steve's technique of:
    he has another form in the conditionalformatting2k mdb
                             to color the current row in a datasheet

then i could just modify that logic:
       instead of coloring the current row

just: display the notes field

tx, s
0
 
LVL 75
ID: 24227082
ok ... just to be clear, when you say 'display' ... are there notes in each row in the datasheet?  and you want to notes from each row to 'display' in a text box on the main form?  Like maybe a bigger text box?

mx
0
 

Author Comment

by:mytfein
ID: 24227324
hi mx,
yes
notes is a field in the record

want to display notes in a field on the main form.

you know, i tried the on enter_event,   it fires when i click on the data cell
but the NOTES is a bound field and is displaying the contents of the FIRST RECORD, and
not the ON CURRENT's notes value... sigh.... tx, s

'Private Sub txtLevelChangeTimeStamp_Enter()
'
'Forms!frmMaintain_Levels_Datasheet!lblNotes.Visible = True
'Forms!frmMaintain_Levels_Datasheet!txtNotes.Visible = True
'Forms!frmMaintain_Levels_Datasheet!txtName.Visible = True
'
'End Sub



0
 
LVL 75
ID: 24227660
ok ... couple more questions:

1) what is the name of the notes text box on the main form

2) what is the name of the notes text box control on the datasheet subform

3) Is the notes text box on the main form 'unbound', ie no Control Source ?

mx
0
 

Author Comment

by:mytfein
ID: 24228050
1) what is the name of the notes text box on the main form
      txtNotes

2) what is the name of the notes text box control on the datasheet subform
      It's not on the datasheet form.  - that's  why i am wishing to click on row, and fill in a large notes
         control on the main form

3) Is the notes text box on the main form 'unbound', ie no Control Source ?
      It's bound to:   Notes

mx, you and andrew have been really kind to me about this issue. thx sooo much,
am leaving for the day... will be in touch on Monday... tx, s
0
 

Author Comment

by:mytfein
ID: 24254560
Hi mx,
sorry, have been out of touch....

using your idea of the On Current Event  and a web link, which I will mention below, I realized that
the On Current event on the subform DOES work, I just did not code it correctly,
the code in the code window works, bec. I'm referring to parent name along with the parent's control.
The code in the window shows the:
   SUBFORM affecting  the PARENT FORM's control.

so let's split points, tx, s




Private Sub Form_Current()
 
Debug.Print "here ", Me!txtFullName
 
Dim frm As Form
Set frm = Forms!frmStudents
 
frm.txtName = Me!txtFullName
frm.txtNotes = Me!txtNotes
 
End Sub

Open in new window

0
 

Author Closing Comment

by:mytfein
ID: 31573537
awarding you full points bec. EE does not let me award myself points -
tx again for your help, s
0
 

Author Comment

by:mytfein
ID: 24254603
Dear Public,
I was not allowed to award myself points, as I posted the quest.
I awarded mx the points bec. he started the solution,
    and the working solution is in the code window above.

tx, sandra
0
 
LVL 75
ID: 24256341
As a side note .... Sandra gets big kudos for:

1) Being attentive and staying on top of her question (quick responses, etc).
2) Fairness in grading / assigning points.

Welcome to EE Sandra ...

mx
0
 

Author Comment

by:mytfein
ID: 24260241
Thx guys...

I have a colleague that inspired me with an idea and i found documentation of his idea in the weblink
below that i forgot to mention in my posting above:
    http://bytes.com/topic/access/answers/852267-detecting-sub-form-event-main-form

look at reply # 11 -  Here the pgmrs wants the PARENT'S form ======> to affect the SUBFORM
                                so WITHEVENTS gives the parent form access to the subform's events

                                (My EE post -                     want SUBFORM ==========> to affect PARENT's form....)

So I thought to myself look's like the ON CURRENT event of subform DOES fire.
So what am I doing wrong with mx's ON CURRENT solution?

You see, I did not have prev. experience with subforms or datasheet forms,
                              I just worked with full size forms.
               One form would open another when user would click command button.
               The opened form could access info from the prev. form (which is hidden) by doing:

Dim frm As Form
Set frm = Forms!frmStudents
 
frm.txtName = Me!txtFullName
frm.txtNotes = Me!txtNotes

so I popped this code into the SUBFORM's on open event, and it worked....
tx, s    
0
 

Author Comment

by:mytfein
ID: 24260270
correction:
THIS SENTENCE IS INCORRECT:
   so I popped this code into the SUBFORM's on open event, and it worked....

SHOULD BE:
   so I popped this code into the SUBFORM's    *** ON CURRENT event ***,   and it worked....
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

830 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