Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Referencing Query to a field on a tab on a form

Status
Not open for further replies.

MKH2001

Technical User
Jan 7, 2003
90
GB
I have this query that works when my field was not placed withing a tab.

However as the form progressed it became necessary to use tabs to split the form into a manageable format.

(I am using access 97)

The query (when it worked)

Code:
SELECT DISTINCTROW tbl_AllSLMastr.UNITID, [Forms]![frm_1in6InspectInput]![UNITID].[value] AS exp
FROM tbl_AllSLMastr
WHERE (((tbl_AllSLMastr.UNITID) Like ([Forms]![frm_1in6InspectInput]![UNITID] & "*") And (tbl_AllSLMastr.UNITID) Not Like "x*"))
ORDER BY tbl_AllSLMastr.UNITID;

The tab is named InspectionDetails.

What the query did was to filter a list of values based on the users input into a field once they pressed the filter button, and return that filtered list to the field as a drop down.

This was done using the form:

Code:
Option Compare Database
Option Explicit



Private Sub UNITID_AfterUpdate()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End Sub

Private Sub UNITID_LostFocus()
UnitID.RowSource = "Qry_UnitID_Combo4"
UnitID.Requery
End Sub

Private Sub Command380_Click()
On Error GoTo Err_Command380_Click

    Dim stDocName As String

    stDocName = "Qry_UnitID_Combo4"
    DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.Close
Exit_Command380_Click:
    Exit Sub

Err_Command380_Click:
    MsgBox Err.Description
    Resume Exit_Command380_Click
End Sub

Any ideas?

 
Placing a field on a tab control has no effect on how you reference it.
If you query worked before it should go on working.
 
Doh, yep you was right.

Seems when moved to the tab the event procedures weren't invoked in the buttons procedures =(

Thank you Lupin for pointing me in the right direction.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top