DoCmd.FindRecord finding some records, but not others?

RSW

Registered User.
Local time
Today, 10:42
Joined
May 9, 2006
Messages
178
I have a combo box that has this as its row source (it's just a select statement that brings up the options we want, I don't think it needs to be scrutinized):

Code:
SELECT tblTestStationEquipmentList.elTEptr, tblTestStationEquipmentList.PartNumber, tblTestStationEquipmentList.Item, tblTestStationEquipmentList.EquipmentID, tblTestStations.TS_Part_Number AS [Test Set], tblTestStations.AreaRefNo FROM tblPartMaster INNER JOIN (tblTestStationEquipmentList INNER JOIN tblTestStations ON tblTestStationEquipmentList.elTEptr=tblTestStations.TEid) ON tblPartMaster.Product_Part_Number=tblTestStations.TS_Part_Number WHERE (((tblPartMaster.ProductTypeId)='ITA')) ORDER BY tblTestStationEquipmentList.PartNumber, tblTestStations.AreaRefNo, tblTestStationEquipmentList.Item;

And this is what happens after the combo box is updated (the whole form is supposed to be updated with data for the selected option)

Code:
Private Sub GetAnotherTS_AfterUpdate()
    Dim lvr As Long
    lvr = Me.GetAnotherTS
    Me.[GoToPoint].Visible = True
    Me![GoToPoint].SetFocus
    DoCmd.FindRecord lvr, acEntire, False, , True, acAll, True

When using the combo box, it works for some selections, but not others. (The same selections do and don't work all the time.) At first glance, there seems to be absolutely no difference between the ways numbers that do and don't work are set up in the database.

Does anyone know why this AfterUpdate event might not work as planned? Or any suggestions as to how to troubleshoot it?

Thanks in advance!
 
Drop a combo box onto the form in the same section where that combo is currently located. Select the third option from the options list and follow the wizard through.
 
Try using this:

lvr = getanotherTS.column(<insert correct column number here>)

put msgbox lvr in your code to make sure that lvr is in fact what it should be. (Or use stop line in code and locals window).
 
Thanks for the assistance, all.

The query that the form is based on was fairly different from the query the combo box was based on. The lvr number was correct, but the form couldn't get to the record, because it was being excluded from the query.
 

Users who are viewing this thread

Back
Top Bottom