Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2003
    Location
    Memphis, TN
    Posts
    13

    Question Unanswered: referencing the 2nd-??? 'occurance' in continuous form

    I looked around for this.. and based on the threads I read that are similar it seems that you can not do this.. However.. I've been wrong many times in my life so I figured I'd ask anyway.. maybe my question will help someone else someday.. maybe I'll be pleasantly surprised too..

    ***************************

    I have a column (named Text53) which is on a subform (sfrmUNITSmonthly) as 'continuous'.. so that it appears a bunch of times.. once for each rows retrieved (let's say 10 rows)... ALSO... "sfrmUNITSmonthly" is itself placed onto ANOTHER subform ("sfrmUNITS"). ON sfrmUNITS is a date field (DATE01). For my 'test' when I change the value of DATE01, I want to change the value of the first TEXT53 on "sfrmUNITSmonthly".

    Now.. in the AFTERUPDATE Event of DATE01, I have:

    Forms!sfrmUNITS!sfrmUNITSmonthly!Text53 = 9009

    When I update DATE01, it in fact changes the value in the first field (top field of continuous) to 9009...

    NEXT... I tried to change the value of the SECOND one... using Forms!sfrmUNITS!sfrmUNITSmonthly!Text53(2) = 1234 -- but that didn't work..
    Guessing at a syntax... I didn't figure it would work.. . but hey....

    QUESTION: Does anyone know a way to reference the 2nd thru ?? occurances in a field displayed as 'continuous'? In properties they all have the same name.. :-(

    As I said I don't think this can be done.. but hope I'm wrong.. I figure that I may need to make individual subforms.. :-(

    TIA. MemphisBill

  2. #2
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133

    Re: referencing the 2nd-??? 'occurance' in continuous form

    Well Bill, it looks that you were right : it can't be done ....

    But you could work around the problem :
    On the AfterUpdate of DATE01, you could run an action query that sets the values directly in the underlying tables.
    Something like this might do it :

    docmd.runsql "UPDATE tblUNITSmonthly SET Field53 = 9009"

    Probably, you'll need to set a condition in the SQL-script to update the correct records.
    Try it and see....

  3. #3
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    quick workaround:

    dim loupe as integer
    for loupe = 1 to 3
    [text53] = "test " & loupe
    docmd.gotorecord, , acnext
    next

    more sophisticated would be to make a recordset based on the underlying query/table of the form and work directly on that recordset.

    izy

  4. #4
    Join Date
    Jun 2003
    Location
    Memphis, TN
    Posts
    13
    Far out.

    Well I get some satisfaction for recognizing that it couldn't be done (directly) but I DO appreciate the comments.

    I will wrestle with this a bit and see how it goes.

    Thank you.

    Bill

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    You ought to be able construct a query string that will update the records in the table based on form criteria. You will then need to refresh your subfrom after executing the query (in VB) in order to see the changes.

    blindman

Posting Permissions

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