Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2005
    Location
    The Hague, Netherlands
    Posts
    95

    Unanswered: Subform +currentRecord

    Hmz, can't get a basic thing to work:

    Form, nothing special, contains a subform (showing a table without filter or whatever, simple query) and a textbox. I want to show the number of the current record that is 'selected' (shown by the black triangle) in the textbox.

    Problem is, I dont know how to use the CurrentRecord-whateveritis in VBA.. If I set the source of the txt to =[frmkamernrs].[CurrentRecord], it just shows #name?, which apparently is not right.

    The idea in the end is to show in a custommade form all the data contained in the table(s). But first: How do I 'detect' the current record in the subform? It can't be that difficult

  2. #2
    Join Date
    Jan 2005
    Location
    United Arab Emirates
    Posts
    23

    Post

    Use the following code in the subform Current Event

    Private Sub Form_Current()
    Me.YourTextBoxName = Me.Recordset.AbsolutePosition + 1
    End Sub

    Change YourTextBoxName qactual name of the textbox

    hope this helps

  3. #3
    Join Date
    Aug 2002
    Location
    Northampton, England
    Posts
    266
    =[CurrentRecord] in the control source of a text box

  4. #4
    Join Date
    Feb 2005
    Location
    The Hague, Netherlands
    Posts
    95
    Quote Originally Posted by DJN
    =[CurrentRecord] in the control source of a text box
    Tried that, but it starts at '1' and stays at '1'. Apparently its not updated when I point at another record?

  5. #5
    Join Date
    Feb 2005
    Location
    The Hague, Netherlands
    Posts
    95
    Quote Originally Posted by ZmrAbdulla
    Use the following code in the subform Current Event

    Private Sub Form_Current()
    Me.YourTextBoxName = Me.Recordset.AbsolutePosition + 1
    End Sub

    Change YourTextBoxName qactual name of the textbox

    hope this helps
    There is no 'current event'? What is the 'subform current event'? If I start 'build event' it gives:

    Private Sub Kamernummers_Enter()
    End Sub


    So, this means when 'entering' the subform, do the following code ? When do I 'enter' this subform?

    -edit-
    Tried it, but the txtbox stays empty. Don't I have to call that sub somewhere? Isn't it a problem that the txtbox is not in the subform but in the mainform?
    Last edited by avlan; 02-14-05 at 09:10.

  6. #6
    Join Date
    Jan 2005
    Location
    United Arab Emirates
    Posts
    23
    here is a sample
    Attached Files Attached Files

  7. #7
    Join Date
    Feb 2005
    Location
    The Hague, Netherlands
    Posts
    95
    Could you post it again in Access97-format? Unfortunately, I'm working with ancient software here 8(
    Thx !!

  8. #8
    Join Date
    Jan 2005
    Location
    United Arab Emirates
    Posts
    23
    here is the 97 format
    Attached Files Attached Files

  9. #9
    Join Date
    Feb 2005
    Location
    The Hague, Netherlands
    Posts
    95
    Quote Originally Posted by ZmrAbdulla
    here is the 97 format
    Heh it gives an error, it doesnt understand the current-statement ... Maybe some access97 thing :s

    Anyway, I AM getting somewhere, if I keep it in the same form, the =[currentrecord] works just fine, but when I add the subform, the record-pointer stays neatly at 1, nevermind what I'm doing in the parentform with the navigator-buttons... Apparently, theyre totally un-attached

Posting Permissions

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