Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    May 2003
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    629
    Thanks
    0
    Thanked 0 Times in 0 Posts

    new record code doesn't refresh (2003sp1)

    This is working code that creates a new record and makes up a "fake" key for the record (basically, it's a human readable equipment label).

    DoCmd.GoToRecord , , acNewRec
    Me.AssetYear = Year(Now())
    Me.AssetOrdinal = Nz(DMax("AssetOrdinal", "Monitortest", "AssetYear=" & Str(Me.AssetYear))) + 1
    Me.PartID = "M" & Right(Str(Me.AssetYear), 2) & LTrim(IIf(Len(LTrim(Str(Me.AssetOrdinal))) = 1, "0" & LTrim(Str(Me.AssetOrdinal)), Str(Me.AssetOrdinal)))




    Later, I reworked the table structure just a little bit, renamed some fields, and now have this on a new form:

    DoCmd.GoToRecord , , acNewRec
    Me.intAssetYear = Year(Now())
    Me.intAssetOrdinal = Nz(DMax("intAssetOrdinal", "tblKeyboard", "intAssetYear=" & Str(Me.intAssetYear))) + 1
    Me.strPartID = "K" & Right(Str(Me.intAssetYear), 2) & LTrim(IIf(Len(LTrim(Str(Me.intAssetOrdinal))) = 1, "0" & LTrim(Str(Me.intAssetOrdinal)), Str(Me.intAssetOrdinal)))


    Seems like the same code to me with different field names. However, in the first form, the values of the fields are immediately updated on the form. On the second form/set of code, they aren't. I have to leave that record and return to see the new data.

    Now, I have no idea when I have to refresh and when it's supposed to be taken care of for me, and once more I cannot get a straight answer from Access Help on how even to refresh all the fields on the active form. Or any form, really. I've taken a few shots at trying to describe "This form - the one right here" using the [Chitty].[Chittty]!Bang!Bang method, but no luck so far.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: new record code doesn't refresh (2003sp1)

    Are the names of the controls the same as the names of the fields they are bound to in the original form? And in the new form?

  3. #3
    5 Star Lounger
    Join Date
    May 2003
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    629
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: new record code doesn't refresh (2003sp1)

    D'Oh ! <img src=/S/headthrob.gif border=0 alt=headthrob width=15 height=15>

    I was sure I had recreated my form from scratch! Apparently, I just copied a template over. Not sure what I was thinking. Now I feel like recreating it.

    I thought it was the "ControlSource" property that I was looking for in that case. But, since Controlsource could be a long SQL string, I guess Name makes sense.

Posting Permissions

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