Results 1 to 3 of 3

Thread: [Access 2000] form object index

  1. #1

    Thread Starter
    Hyperactive Member Davadvice's Avatar
    Join Date
    Apr 2007
    Location
    Glasgow (Scotland)
    Posts
    440

    [Access 2000] form object index

    hello,

    when i add a txtbox to a form how does access index this ?

    i have the below code that will itterate through the form objects and add the data from the Record set.

    The issue i have is when i add a new textbox this then becomes the last indexed object on the form. i have updated the sql so that it wil corispond with the text box however the RS is not corisponding to the SQL

    SQL Code:
    1. SELECT tblTechInfo.JobNo, tblTechInfo.ExisitngMeterModel, tblTechInfo.ExistingMeterType, tblTechInfo.ExistingMeterManufacturer, tblTechInfo.ExistingMeterSerialNo, tblTechInfo.IntendedGasUsage, tblTechInfo.HourlyCapacity, tblTechInfo.AdditionalHourlyCapacity, tblTechInfo.TotalHourlyCapacity, tblTechInfo.AQ, tblTechInfo.TypeOfLoad, tblTechInfo.TypeOfSupply, tblTechInfo.InletPressure, tblTechInfo.MeterHousing, tblTechInfo.MeterBase, tblTechInfo.Converter, tblTechInfo.ChatterBox, tblTechInfo.AMR, tblTechInfo.Booster, tblTechInfo.TwinStream, tblTechInfo.ByPass, tblTechInfo.Purge, tblTechInfo.ProposedMeterLocation, tblTechInfo.SpecialistMeterEquip, tblTechInfo.RequiredMeterModel, tblTechInfo.OutletPressure
    2. FROM tblTechInfo
    3. WHERE (((tblTechInfo.JobNo)=1));

    VB Code:
    1. For Each ctl In Me.Controls
    2.     If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Then
    3.         'debug is used to test the field corisponds with the textbox'
    4.  
    5.         Debug.Print M_RS(i).Name
    6.         Debug.Print ctl.Name
    7.  
    8.         If Not IsNull(M_RS(i)) And Not M_RS.EOF Then
    9.             ctl.Value = M_RS(i)
    10.         End If
    11.         i = i + 1
    12.     End If
    13.    
    14.    
    15. Next
    the item prefiexed (txt,cbo)are the form objects
    DEBUG output Code:
    1. JobNo
    2. txtJobNo
    3. ExisitngMeterModel
    4. txtExistingMeterModel
    5. ExistingMeterType
    6. cboExisitngMeterType
    7. ExistingMeterManufacturer
    8. cboExisitingMeterMnufacturer
    9. ExistingMeterSerialNo
    10. txtExisitingMeterSerialNo
    11. IntendedGasUsage
    12. cboIntendedGasUsage
    13. HourlyCapacity
    14. txtHourlyCapacitySHQKWCurrent
    15. AdditionalHourlyCapacity
    16. txtHourlyCapacitySHQKWAddiitional
    17. TotalHourlyCapacity
    18. txtHourly CapacitySHQKWTotal
    19. AQ
    20. txtAnualQuantity
    21. TypeOfLoad
    22. cboLoadType
    23. TypeOfSupply
    24. cboSupplyType
    25. InletPressure
    26. cboInlet Presure
    27. MeterHousing
    28. cboProposedMeterLocation
    29. MeterBase
    30. txtSpecialistMeteringEquipment
    31. Converter
    32. cboRequireMeterModel
    33. ChatterBox
    34. txtOutletPresure

    My objective is to have outletpresure and txtoutlet presure running one after the other.

    can anyone advise why the RS will not corispond with the form objects or how i can re-index the form objects. without using a number to create a control array style form?

    thanks in Advance
    This is Blank

  2. #2
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,657

    Re: [Access 2000] form object index

    I think that it based on the order you added the control on the form !! i might be wrong as not been able to test in access, but if you add a new form and put 3 controls on it then run this -

    vb Code:
    1. For Each ctl In Me.Controls
    2.     MsgBox (ctl.Name)
    3. Next

    i bet that it lists the controls in the order you added them to the form !
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



  3. #3

    Thread Starter
    Hyperactive Member Davadvice's Avatar
    Join Date
    Apr 2007
    Location
    Glasgow (Scotland)
    Posts
    440

    Re: [Access 2000] form object index

    hi,

    you are correct, it does, I tried editing the Tab order to see if this would adjust the object index but it did not. I'm not sure if there is a hidden property that stores the index this would help me if it was updatable.

    thanks
    David
    This is Blank

Posting Permissions

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



Click Here to Expand Forum to Full Width