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));
the item prefiexed (txt,cbo)are the form objectsVB 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
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


Reply With Quote
