Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

papadilbert (Programmer) (OP)
24 Jan 12 15:55
On Form0 I have a tabbed form.  On Page1 I have Form1. On Page2 I have Form2.

Form1 has a button that adds a row to Table2 that is displayed by Form2

Form2 is a continuous display form that uses a query as its Record Source to display Table2 rows.

After clicking the button on Form1 to add a row to Table2, I click on Page2. Form2 does not show the new row.

I've tried adding to the end of the button_click() routine: Forms!Form0!Form2!Form.Requery

If I exit Form0 and reopen it, Form2 displays the new row.


 
dhookom (Programmer)
24 Jan 12 16:41
Do you get any error messages?
Does your code compile?
Do you have Option Explicit in your code General Declarations?
Is Form2 the name of the subform control on Form0? The name of the subform control is not always the same as the source object.

Can you share your actual code?

Duane
Hook'D on Access
MS Access MVP

TheAceMan1 (Programmer)
24 Jan 12 23:24
How are ya papadilbert . . .

CODE

Change: Forms!Form0!Form2!Form.Requery
To    : Forms!Form0!Form2.Form.Requery
Your Thoughts? . . .

See Ya! .  .  .  .  .  .

Be sure to see FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?  Worthy Reading! thumbsup2
Also FAQ181-2886: How can I maximize my chances of getting an answer?  Worthy Reading! thumbsup2

papadilbert (Programmer) (OP)
30 Jan 12 12:38
Yep. Sorry,  I typeo'd the post. I have the dot in the real code. It doesn't work. I tried other approaches. This is the latest...real code.

DBTracker is a tabbed form. One of the tabs holds the form "People", and another form "EmailTracker"


'   Code executed from button on the People subform of DBTracker
'
'   The SQL statement is built.
'   The SQL statement is executed.
'   A row is added to the EmailTracker table'
'   The EmailTracker form is Requery'd
'
'   But when the tab with the EmailTracker subform is clicked,
'   The new row is not displayed.
'
'   However, now with the latest change to the Requery
'   statement, when another row is added, both rows are then
'   displayed.
'   
'   It's like the first Requery was buffered. This "buffering' repeats. It's like it takes more than one new row to be added before the "Requery" will display them.


strSQL = "Insert Into EmailTracker (RecipientID, _
          EmailType, EmailDatelastGenerated) values _
          (" & Me!ID & " , 'Verify DBA', '" & Now & "');"

CurrentProject.Connection.Execute strSQL, , _
          adCmdText + adExecuteNoRecords

Forms!DBTracker.Form.EmailTracker.Form.Requery

 
Helpful Member!  dhookom (Programmer)
30 Jan 12 13:18
Do you understand the difference between the subform control's Name and its Source Object?

If the code is running from a subform, try:

CODE

   Me.Parent.EmailTracker.Form.Requery
 

Duane
Hook'D on Access
MS Access MVP

papadilbert (Programmer) (OP)
30 Jan 12 14:10
Yep, I know the difference. And yes, I named them the same. I'm not very imaginative :)

I tried tweaking the Requery. This works. Yippee!!!

Forms!DBTRacker.Form!EmailTracker.Form.Requery


Can someone provide a technical explanation of the difference between the above statement and the one below that doesn't work so well?

Forms!DBTRacker.Form.EmailTracker.Form.Requery

 
papadilbert (Programmer) (OP)
30 Jan 12 14:21
Ah. Is it that one refers to the Control and the other refers to the Source Object?

The light might be getting a bit brighter.
TheAceMan1 (Programmer)
31 Jan 12 5:39
papadilbert . . .

What version Access? ... Its scary to find Ms.A not following her own rules. I'd expect several other form referencing lines of code presented here ... to work!

See Ya! .  .  .  .  .  .

Be sure to see FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?  Worthy Reading! thumbsup2
Also FAQ181-2886: How can I maximize my chances of getting an answer?  Worthy Reading! thumbsup2

papadilbert (Programmer) (OP)
31 Jan 12 10:09
Access 2003. Can you tell me more about the rule?
TheAceMan1 (Programmer)
31 Jan 12 20:23
papadilbert . . .

I'm not so sure its the form referencing at fault. In fact I query the ADO method your using. I'm not hot on ADO yet and it would take to long for me to nail it if there is a problem. What I suggest is a DAO version in a temporary button for testing. The code for the temp button would be:

CODE

   Dim db As DAO.Database, SQL As String
   
   Set db = CurrentDb
   SQL = "Insert Into EmailTracker (RecipientID, " & _
                                   "EmailType, " & _
                                   "EmailDatelastGenerated) " & _
                           "VALUES (" & Me!ID & " , " & _
                                    "'Verify DBA', " & _
                                    "'" & Now & "');"
   db.Execute SQL, dbFailOnError
   DoEvents
   
   Forms!DBTracker!EmailTracker.Form.Requery
Let me know how this fairs. If it works then there's some problem in your ADO ... perhaps how the connection is setup (just a guess).

Your Thoughts? . . .

See Ya! .  .  .  .  .  .

Be sure to see FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?  Worthy Reading! thumbsup2
Also FAQ181-2886: How can I maximize my chances of getting an answer?  Worthy Reading! thumbsup2

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close