Requery Button

whojstall11

Registered User.
Local time
Today, 05:41
Joined
Sep 7, 2011
Messages
94
I have and query and a form. ON the form i have two combo boxes. I have a function that i call on update of the combo boxes it requerys the data
Code:
Function Re(T As String)
 On Error GoTo Re_Err
  
    DoCmd.Requery "List105"
    
 
Re_Exit:
    Exit Function
 Re_Err:
    MsgBox Error$
    Resume Re_Exit
End Function
But when I change data on the other combo box it does requery right. It disregards the other combo box and adds ALL its data in the results. Instead of filtering some data out based on what I already have.
This is my sql code
Code:
SELECT [Copy Of Asset to BU2].BU_Name, [Copy Of Asset to  BU2].Year, [Copy Of Asset to BU2].Expr1002 AS Device, [Copy Of Asset to  BU2].AssetNumber, [Asset to BU].UserName, [Copy Of Asset to BU2].[Date  Ordered], [Copy Of Asset to BU2].Status, [Copy Of Asset to BU2].[Model  Number], [Copy Of Asset to BU2].[Warranty Expiration], [Asset to  BU].User
FROM [Asset to BU] RIGHT JOIN [Copy Of Asset to BU2] ON  [Asset to BU].AH_Assinged_AssetNumber = [Copy Of Asset to  BU2].AssetNumber
WHERE ((([Copy Of Asset to  BU2].BU_Name)=forms![Final Bu Search]!Combo25)) Or ((([Copy Of Asset to  BU2].Year)=forms![Final Bu Search]!Text45)) Or ((([Copy Of Asset to  BU2].Expr1002)=forms![Final Bu Search]!Combo62)) Or ((([Copy Of Asset to  BU2].AssetNumber)=forms![Final Bu Search]!Text46))
ORDER BY [Copy Of Asset to BU2].BU_Name;
 
Are you requerying the combo box in the After Update event of the updating control?
 
Yes I have i Have two combo box (BU Name, Device Type) in both of their after update section I call my requery funcution(Function Re).
 
If all you're doing is calling the Requery command, then your Requery function is an overkill. DoCmd.Requery will requery the active object.

To requery a combo box you need to reference it directly:
Code:
Me.ComboBoxName.Requery
Remember, it's better to be explicit in your call to an object.
 
I dont understand when i call my funcution "re" im telling it what combobox i want
Code:
= re(combo26)
and my results goes in to an unbound list box thats link to my query table
 

Users who are viewing this thread

Back
Top Bottom