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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ACCESS 2000 VBA

Status
Not open for further replies.

hrg

Programmer
Jan 8, 2009
46
US
I have a search query using a list box. But for some reaosn it does not refresh or setfocus even though i have told it to. I have looked at the code and can not see any faults. I think the problem is that i have to set other parameters. I have enabled the box and also tried to unlock and lock the list box but to no avail.i am calling the two methods if i have clicked on an event. coding below

Private Sub LstUpdate()
LstComp.SetFocus
LstComp.Requery

End Sub

Private Sub Cmdsearch_Click()
If IsNull(TxtCpCode) And IsNull(txtCompnm) Then
MsgBox ("Please enter Company Code or Comapny Name")
Else
Call LstUpdate
End If
End Sub

Lstcomp= list box
TxtCpCode & TxtCompnm = txt box

Am i missing something

 
Refresh | Requery

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Not sure how this is working. Are you selecting an item in the list box and wanting details for that item to appear in the text box? If you are requerying the list box, what are you expecting to appear there, if the user has entered a company code?

I have searches using values selected in combo boxes, which is not much different, but I am requerying the FORM, so that the cureent record viewed on the form is the one selected in the combo box. I cannot see why you would requery the combo box (or in your case the list box).

Can you advise more on what the user input is and what you expect to happen when the command button is clicked? Have fun! :eek:)

Alex Middleton
 
Hello!
Why don't you try this!!

Private Sub Cmdsearch_Click()
If IsNull(TxtCpCode) And IsNull(txtCompnm) Then
MsgBox "Please enter Company Code or Comapny Name"
Else
me.lstupdate.requery
me.lstupdate.setfocus
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top