User Profile

Collapse

Profile Sidebar

Collapse
laurajchambers
laurajchambers
Last Activity: Oct 19 '15, 08:43 PM
Joined: Aug 14 '14
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Hi NeoPa. The topic of my thread remains the same - I'm trying to get my code to fire on a form event (insert and delete) instead of a control event. I'm not seeking advice on returning to my record after requery as I found code to do this. My code now works fine on an after update on a control on the subform but I want it to work on a form event.
    See more | Go to post

    Leave a comment:


  • The problem is that the subform does not recognise that a new record has been added until records are navigated, therefore the code you suggest won't fire when I need it to. I need the count textbox to update as soon as data is inputted into a new record.
    See more | Go to post

    Leave a comment:


  • hvsummer - I don't think on click, on load, on active or on got focus are relevant to me requiring the action when I add or delete a record? If I put the code on onclick my screen will be constantly flicking whilst I'm moving around the subform. Isn't on data change just related to pivot tables?
    See more | Go to post

    Leave a comment:


  • NeoPa - thanks for confirming that Requery is the only way forward. I was getting very frustrated as I thought I was missing something.

    I have searched for information on how to bookmark my record and return to it after Requery and came up with the following:

    I have created a public sub in the main form "Students" as follows ("Medical1" is the name of the control of the subform):

    Code:
    Public
    ...
    See more | Go to post
    Last edited by NeoPa; Sep 27 '15, 10:20 PM. Reason: Restored original.

    Leave a comment:


  • Hi NeoPa. My goal is still to get the Count textbox updating automatically when I either add or delete a record. Is the only way to do this via a Requery which will resort the data? Or is there a way I can force the Count textbox to update without affecting the record order please?
    See more | Go to post

    Leave a comment:


  • Unfortunately I still haven't been able to get it to work. Are you saying it can't be done, NeoPa?

    So I think I need to put the code in the Before Insert event of the subform. I thought I should DoCmd save record in the first line. Then I'm stuck. Me Requery and Refresh on the main form are causing the record order to change, and Recalc and Repaint don't do anything.
    See more | Go to post

    Leave a comment:


  • Hi NeoPa

    Sorry for the delay in responding to your detailed post; I have been very busy at work this week.

    I tried your test code tonight and it revealed that the After Insert event is not firing when I add a new record and am still on that new record - it only fires once I navigate to another record on the main form.

    The After Del Confirm works fine. And I also noticed that the count does update correctly...
    See more | Go to post

    Leave a comment:


  • laurajchambers
    replied to if statements
    Do you need to add
    Code:
    Exit Sub
    after each of the
    Code:
    MessageBox
    lines?
    See more | Go to post

    Leave a comment:


  • Hi NeoPa

    Thanks for continuing to comment on this thread.

    On my main form I have added a Command Button with the code

    Code:
    Me.Medical1.Requery
    Medical1 is the name of the subform control on the tab page. When I manually click this the count updates on the subform. The count also updates when I navigate backwards and forwards on records on the main form.

    I have tried
    Code:
    Me.Requery
    on the...
    See more | Go to post

    Leave a comment:


  • Hi NeoPa. I understood from your first post that you were suggesting something like Me.Requery on the subform's after update / after insert but this did not do anything. I also tried requerying the main form but this also did not do anything. The only thing that has updated the count is when I requery the subform control from the main form. I'm just not sure how to do this in the subform's after update / after insert. Thanks.
    See more | Go to post

    Leave a comment:


  • Thanks, NeoPa. I've been experimenting with this but requesting the requery from the subform does not seem to work.

    I created a command button on my main form which had vba to requery the subform control and that manually updates the count, but obviously I would like it to be automate when the subform updates/inserts. I could hide the command button and set focus on it in vba from the subform's after update/insert, but thought there...
    See more | Go to post

    Leave a comment:


  • laurajchambers
    started a topic Count text box on Subform not updating

    Count text box on Subform not updating

    Hi

    I have a main form with a tab control, and each tab has a subform linked to the main form. Each subform has an unbound text box with the control source =Count([Sub_ID]).

    When the main form opens the count text boxes are correct, but if I add a record to the subform the count does not update. I have tried VBA on the subform's after update and after insert to requery the count text box but this is not making any difference....
    See more | Go to post

  • Hi again, NeoPa

    I managed to get your tag working. <font color=red>WORD</font>

    The previous time I enclosed it within '&' as I thought it would need connectors. But I just removed those and it works perfectly.

    Thanks for pointing me in the right direction - much appreciated.

    Laura
    See more | Go to post

    Leave a comment:


  • Thanks for your replies, NeoPa.

    I'm using Access 2007. To format the text box to Rich Text I went into the Property Sheet and changed 'Text Format' to Rich Text on the 'All' tab.

    Unfortunately I don't want every occurrence of the word to be red font, so I don't think <font color=red>red</font> will achieve what I need it to?

    I have tried the toolbar but it appears to change the font colour of the...
    See more | Go to post

    Leave a comment:


  • Change text colour of part of text within text box on report

    Hi

    I have a text box on a report which is formatted to Rich Text.

    The text box has a large amount of text and I would like to format some words to a different text colour, e.g. Red. I've been trying to do it in HTML but nothing is working. Maybe I can achieve this in VBA? However I was hoping there would be a simple way to do it within the text box - ?

    Can anybody help please?
    Thanks
    See more | Go to post

  • That was the title of the post from 'Leigh P's discussion, but it also describes what I'm hoping to achieve.

    When I change the name of the query to include underscores at the start and end of the name, it then appears to skip past that error and then the next issue I get is an ODBC Microsoft Access Driver Login Failed error message: Could not find the file 'C:\Users\Laura \Documents.mdb' . I can't see why it's trying to find that file...
    See more | Go to post

    Leave a comment:


  • Automate the closing of Word from Access after MailMerge

    I'm trying to adapt and use code provided by 'Leigh P' to automate a mailmerge from Access, but it is not working.

    I'll paste my code below. I have the code saved in a module, and I'm calling the function from a command button on a form.

    The error I'm currently getting is a Microsoft Office Word error: "The Microsoft Office Access database engine cannot find the input table or query 'ailmerge_Sourc e_Safeguardin'....
    See more | Go to post
    Last edited by Rabbit; Aug 14 '14, 04:07 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
No activity results to display
Show More
Working...