[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:
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
FROM tblTechInfo
WHERE (((tblTechInfo.JobNo)=1));
VB Code:
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Then
'debug is used to test the field corisponds with the textbox'
Debug.Print M_RS(i).Name
Debug.Print ctl.Name
If Not IsNull(M_RS(i)) And Not M_RS.EOF Then
ctl.Value = M_RS(i)
End If
i = i + 1
End If
Next
the item prefiexed (txt,cbo)are the form objects
DEBUG output Code:
JobNo
txtJobNo
ExisitngMeterModel
txtExistingMeterModel
ExistingMeterType
cboExisitngMeterType
ExistingMeterManufacturer
cboExisitingMeterMnufacturer
ExistingMeterSerialNo
txtExisitingMeterSerialNo
IntendedGasUsage
cboIntendedGasUsage
HourlyCapacity
txtHourlyCapacitySHQKWCurrent
AdditionalHourlyCapacity
txtHourlyCapacitySHQKWAddiitional
TotalHourlyCapacity
txtHourly CapacitySHQKWTotal
AQ
txtAnualQuantity
TypeOfLoad
cboLoadType
TypeOfSupply
cboSupplyType
InletPressure
cboInlet Presure
MeterHousing
cboProposedMeterLocation
MeterBase
txtSpecialistMeteringEquipment
Converter
cboRequireMeterModel
ChatterBox
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
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:
For Each ctl In Me.Controls
MsgBox (ctl.Name)
Next
i bet that it lists the controls in the order you added them to the form !
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