Results 1 to 6 of 6
  1. #1
    Join Date
    May 2006
    Posts
    178

    Unanswered: Refreshing data on subforms

    Hi guys, (access 2000)

    Im having a problem with refreshing subforms.

    I have 2 subforms on one page both linked to the same table. I use one for data entry while the other shows the list of records in a grid.

    I have command button on the main form which i use to refresh the form.

    This initially worked but all of a sudden the subform i was adding data to didnt update, until i close the form and reopened it.

    I deleted the subform and replaced it with another identical form again this worked for a short period. all of a sudden it stopped.

    Im just wondering if any of you have come across this, if so how did you sovle it?

    Thanks for your help

    aboo
    Last edited by aboo; 02-12-09 at 04:05.

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    What I do with this kind of setup is I have the RecordSource of the subform (where data entry is taking place) with a SQL like this:

    "Select * from dbo_MyTableName where MyIDField = " & Forms!MainFormName!ListIDFields & ""

    ListIDFields would be the listbox making sure the first column is the ID field.

    When a field is clicked in the listbox, I simply requery the form: ie.
    me.mysubformname.requery

    and then edit data without problems.

    I'm not quite sure how you have your subform set up. I geuss the question would be what is the recordsource for your subform?
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    May 2006
    Posts
    178
    Hi PKstormy,

    Thankyou for your response. Well here is my set up.

    I have 2 subforms on the main form. I have one setup as data entry and the other as grid.

    The record source for both are the same table.

    Im sorry to further pester you can you please do a break down of the SQL for me, as i am not so familiar witht he syntax.

    Thankyou

    Aboo

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    in the subform(s) create a fucntion whihc does a refresh

    me.refresh

    you may even be abel to do

    MySubform.refresh
    it may be .requery
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    May 2006
    Posts
    178
    Healdem,

    How would i create that? as a command button within the subform? i dont understand.

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    whatever is cusing the data to be out of date or whatever you want to use to triugger a refresh

    it could be a command button
    it could be a timer
    it could be after an evetn has occurred which you know invalidates or requires a refresh

    place some code which forces a refresh in the relevant subform(s)
    it could take the form of

    Code:
    MySubform.refresh
    Code:
    MySubform.requery
    Code:
    MySubform.recordset.requery
    whether you implement it as a call int he sub form to a public function or subroutine, or a public method in the parent for is irrelevant.
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •