Almost But Not Quite - Requery Listbox Problem

Oct 27, 2005

Hi all - first post for me, a long-time user of the site though!

I have a form (frmEnquiryFor) where so far everything works almost as I want it! I have a text box (txtCompanyName) and below it a list box (lstCustomer). What I want to happen is that as a user types into the textbox, the listbox below updates on each keystroke. At the moment, this doesn't quite happen: what happens currently is that if the user types into the listbox and then hits return, the listbox updates as it should.

The listbox's rowsource is based on the SQL statement:
"SELECT [qryCustomerLookup].[CustomerName], [qryCustomerLookup].[CustomerCode] FROM qryCustomerLookup; "

The query underlying this, qryCustomerLookup, works as it should. What it does is if the user has typed in nothing, it returns all the Customer names and customer codes. If the user types in "a", it returns all the customer names and codes of customers beginning with "a". If the user types in "ab", it returns them all from customers beginning with "ab". (In case you need it, the SQL for this query is as follows:
"SELECT tblCustomers.CustomerName, tblCustomers.CustomerCode
FROM tblCustomers
WHERE (((tblCustomers.CustomerName) Like [Forms]![frmEnquiryFor]![txtCompanyName] & "*")) OR (((([tblCustomers].[CustomerName]) Like [Forms]![frmEnquiryFor]![txtCompanyName] & "*") Is Null));"

The final bit of code is just a bit of VBA - "Me!lstCustomer.requery" - that I have tried putting in various places. I have put this code in the "after update" event of txtCompanyName, and this comes close to working. What this does is update the listbox correctly, but only after the user hits the enter key after entering a letter or two. What I want is to find a way to make the listbox update after each keypress.

I've tried putting this requery code in the keypress event, the keyup event, the onchange event, all to no avail. I think the problem may lie in the timing of the event firing, but I'm not sure.

So - any ideas?!?! :confused:

View Replies


ADVERTISEMENT

Requery Value Of Combo To Listbox

Oct 3, 2006

Hello,

I have a form with a text box, a combo and a listbox.

The textbox stores the name of the user.

The combobox gets its data from a query.

I would like that when I open my form, by default the list box will show all the records of a table named Master and then, I would use the combo to requery the list by selecting another user. All records under that criteria, will have to show up in the list box.

Any help? Thank you.

View 1 Replies View Related

Listbox Selections Requery Subfrm

Aug 24, 2006

I have a form that has names with a subform with information. The contacts are in a list box and the subform (in datasheet view) shows the phone number/email/etc.. of the selected contact person. I am using the form as a quick look up of a persons information. Before changing it to a list box, it was previously a combo box, and everything worked fine. i was able to requery the subform and the cooresponding info for the person would come up. However, its now a list box and i am having problems with the code to make this happen. I have a different button sending the names selected from the list box to a report...and that works fine, but i am obvisouly missing something to make it work with the subfrm requery. Below is the code i got so far. Any help would greatly be appreciated. its driving me nuts!

Private Sub QuickLookup_Click()
Dim varItem As Variant
Dim strWhere As String
strWhere = "[memberID] = "
For Each varItem In Me.MemberID.ItemsSelected
strWhere = strWhere & Me.MemberID.ItemData(varItem) & " OR [memberID] = "
Next varItem
strWhere = Left(strWhere, Len(strWhere) - 17)
DoCmd.Requery "subfrmqryindividual"

View 2 Replies View Related

Am I Missing Sumting? Listbox Requery Subform

Nov 13, 2005

can any1 tell me y im missing in my db?
look at Monthstock form...

plz tell me step -by-step how to do it..plz..im new

View 7 Replies View Related

Requery Listbox On Form1 When Form2 Is Closed

Dec 12, 2006

What line of code do I need to requery a listbox on Form1 when I close Form2?

I'm pretty sure I need to put it in the OnClose Event of Form2, but I don't know how to reference the Listbox on Form1.

Thanks
ScrmingWhisprs

View 4 Replies View Related

Modules & VBA :: Requery Listbox With Value From Combo Box Loses Format

Mar 19, 2015

I have a listbox on a form with several fields, 3 of which are currency fields.When I filter the listbox using afterupdate from a combobox on the same form, the listbox loses the currency format on the fields.

Code:
cboprop_AfterUpdate()
Dim ListFilter As String
ListFilter = "SELECT [qry_inv_form].[inv_no], [qry_inv_form].[prop_ref], [qry_inv_form].[inv_date2], [qry_inv_form].[inv_desc_type], [qry_inv_form].[inv_net], [qry_inv_form].[inv_vat], [qry_inv_form].[inv_total], [qry_inv_form].[year_month], [qry_inv_form].[month_text] " & _
"FROM qry_inv_form " & _
"WHERE [qry_inv_form].[prop_ref] = '" & Me.cboprop & "'"
Me.inv.RowSource = ListFilter
Me.inv.requery

I tried wrapping the fields in Format(fieldname, "Currency") but that came back with a syntax error.

View 2 Replies View Related

Copying Data Within Same Form From A Listbox Containing A Query To A Blank Listbox?

Apr 21, 2006

Hi, I'm new here, so I hope I'm posting this in the correct place. I've searched the forum to see if there are any existing threads that might help me, but I've not found anything that does...
(I think this thread ( http://www.access-programmers.co.uk/forums/showthread.php?t=93444&highlight=Copying+data )may be trying to achieve something similar to me, but I'm a beginner and don't really understand it)

I shall stop waffling! I'm not entirely sure that what I'm trying to achieve is possible, I expect it probably is!

Right, I have a form (frmGroupRegister, which contains exactly the same fields as the table it comes from, tblGroupRegister), which consists of three things:

-GroupDate - The date a group took place on. It is my primary key, as no more than one group occurs on a specific date.

-ParentList (A listbox which contains a query showing the ID number, forename and surname of everyone in a table, tblParentDetails)

-ParentsAttending (A blank listbox)

I would like to place buttons in between the ParentList and ParentsAttending, which would allow users to conduct a 'register' of attendance by copying individual/multiple details from ParentList into ParentsAttending (much like you get when choosing which fields to include in a form when using a wizard for example). I would also like them to be able to remove people from ParentsAttending by using a button in case of accidentally adding the wrong person into the ParentsAttending box.

I'm aware that another, probably simpler way of achieving this would be to use a tick-box system, but I feel that visually, the first method would both look better and demonstrate who is present more clearly.

Any help would be much appreciated, but my Access skills are quite basic and things will probably need to be spelled out for me.
I'm using Access 2000 and Windows XP.
Thanks for your help,
Alice :)

View 1 Replies View Related

Forms :: Dynamic Row Source For Listbox From Multi-select Listbox

Jun 10, 2015

I am using the selections made of the form to generate a query for the user.

I have a CITIES listbox that is populated with values from a stored query.

I would like to make it multi-select and populate a LOCATIONS list box and a NAMES list box based upon the CITIES that are selected.

I have the locations currently populated from a stored query that reads the City selection from the Form. It looks like this

Code:

SELECT DISTINCT (t_location.LOCATION) AS Expr1
FROM t_location INNER JOIN t_asset_master ON t_location.LOCATION_PHY_ID = t_asset_master.LOCATION
WHERE (((t_location.CITY)=[Forms]![MasterQueryGenerator]![CityList]));

I also want multi-select so that is you can un-select all and get the results for all cities.

Here is my half thought approach.

Code:

Private Sub CityList_AfterUpdate()
'Dim LocQryStr As String
'Dim r As Integer
'Dim ctl9 As Control
'LocQryStr = "SELECT DISTINCT (t_location.LOCATION) " & _

[Code] ...

I intended to have the variable LocQryStr as the row source but I abandoned the idea of having multi-select when I saw that .Selected(I) never returned true. Its like the values aren't read in this subroutine.

View 5 Replies View Related

Forms :: Listbox To Show Types Based On Section In Other Listbox

Sep 9, 2013

I have a list box called "product list box" based on a query called "searchqry", i also have another listbox called "type list box" , how do i get the type list box to only show "types" based on the section in products list box?

View 1 Replies View Related

Forms :: Passing Listbox Rowsource To Another Form Listbox

Dec 14, 2014

Using a popup form

1. On my main form, I have a listbox, I would like to edit the values of the listbox.

To do this, I have a popup form with 2 listboxes, one to have the values of the listbox on the main form, and the other listbox with option values for the 1st

1) how to i pass the rowsource sql of the listbox on the main form to the listbox on the popup form

2) how on closing the popup form, do i update the rowsource sql listbox on the main form from the changed value of the popup form listbox rowsource sql

View 3 Replies View Related

Forms :: Make Listbox Visible After Selection Of Another Listbox

Oct 23, 2013

Okay then, after much trouble and confusion, I finally realized I need to use an Extended listbox in order to allow for multiple items to be selected from a list on my form (rather than the evil multiple selection combobox!).

However, now I am trying to figure out how to make one listbox (IndustryClassification) only be visible if the item "Industry" is selected in another listbox (TypeOfBusiness). Coding I can use for this in the AfterUpdate event of the listbox?

View 7 Replies View Related

Select All Listbox AND Update Listbox

Jun 17, 2005

Hello,

I've got this multiple select listbox which writes data into a textbox:

Private Sub List2_AfterUpdate()

Dim Cursisten As String
Dim ctl As Control
Dim Itm As Variant

Set ctl = Me.List2

For Each Itm In ctl.ItemsSelected
If Len(Cursisten) = 0 Then
Cursisten = ctl.ItemData(Itm)
Else
Cursisten = Cursisten & "," & ctl.ItemData(Itm)
End If
Next Itm
Me.txtCursisten = Cursisten

End Sub

And I've got a SELECT ALL button to select all records in the listbox:

Private Sub cmdSelectAll_Click()
On Error GoTo Err_cmdSelectAll_Click

Dim i As Integer

If cmdSelectAll.Caption = "Alles Selecteren" Then
For i = 0 To Me.List2.ListCount
Me.List2.Selected(i) = True
Next i
cmdSelectAll.Caption = "Alles De-Selecteren"
Else
For i = 0 To Me.List2.ListCount
Me.List2.Selected(i) = False
Next i
cmdSelectAll.Caption = "Alles Selecteren"

End If

Exit_cmdSelectAll_Click:
Exit Sub

Err_cmdSelectAll_Click:
MsgBox Err.Description
Resume Exit_cmdSelectAll_Click

End Sub

The only thing is that when I use the SELECT ALL button, the function List2_Afterupdate doesn't work anymore. There must be a simple solution but I just can't figure it out. Can anyone please help me?

Tnx a lot!

View 13 Replies View Related

Move Items From Listbox To Other Listbox

Jul 16, 2006

Hello everybody,

Hopefully somebody can help me on this one. I searched the whole internet and access forums, but I didn't find the exact solution for my problem.

I've got a table with students, a table attendance, where I now only save the students who are absent, but I would like to save also the students who are PRESENT (at the same time).
I've got a combobox where I filter the Class, which then updates a listbox with the students from that class. What I do now is select the students from the listbox and then press a save button and it saves the records to the table absence with STATUS: ABSENT.

I would like to save the NON selected students also in that table, but with PRESENT in the column STATUS.

I thought of making another listbox next to it, where after selecting the absent students, they wil apear and disappear in the PRESENT table so I can store all the information.
But the only problem is that I can find this solution when the listbox is populated by a list of values instead by a table or query. And the other solution is to store the temporary data into 2 different tables, but that's not working for me because it's a multi user database and everything will be messed up.

Hope that someone can help me, I will be very happy.

View 4 Replies View Related

Forms :: Hide Unchecked Values In A Listbox - Create Hyperlink On Listbox Values?

Jan 20, 2014

Firstly, is it possible to hide unchecked values in a listbox? I have a user with several roles and I want to only show the ticked roles in the listbox.

Secondly, can you create a hyperlink on listbox values? i.e, if I click on "Manager" in the roles listbox, it follows that to another form and opens the record about managers?

View 10 Replies View Related

Requery

Nov 2, 2006

Hi,
I have a search form and a form that display the result of the search based on the search criteria from the search form. The query works just fine and the search results are displayed well but the problem is the following: the query doesn't work with the new records inserted in those tables, only records that were in the table at the moment i had developed that search button are displayed. If someone can tell me if there exist a sort of "requery" method for that query to display the new records.

Thanks,
b0gdan

View 2 Replies View Related

Requery

Mar 28, 2005

Can't figure out where to put Me.Requery

I have a combo box [product] on my main form. On AfterUpdate of the combo I have it set to run a DLookup on a query (which is created with "tblPlan") and place that calculation in another field [costsavings]. This is working great, however, I update tblPlan each month and want it to update the calculation when I open the form instead of having to re-select the product again to trigger the query.

I have tried Me.Requery and Refresh for both the form and the combo on the main form's OnOpen and OnActivate events and it does not work.

Could someone please tell me where I need to place the code?

Thanks!

Toni

View 2 Replies View Related

How To Use Requery?

Jul 12, 2005

i have a form which contains a query and a subform. I want to click button A to refresh the query and then click button B to refresh subform.

Button A: me.requery

Button B: me.subform.requery.

However, button B doesn't work. Do they conflict?

Thanks a lot.

View 7 Replies View Related

Requery?

Jan 25, 2006

I have a form ("Clients") that points to a "Clients" table. I also have a form ("AddEditClient") that points to same table.

Open Clients form and you see client info. Have at the bottom 2 buttons. One to create a new client and one to edit the current client. B/c we do not want user to edit clients from main client form (most fields are locked on this form). So if the user clicks on "edit client" button takes them to same record on AddEditClient form... now they can edit the client (fields are not locked). If they click the "add client" button it takes them to a blank new record on the AddEditClient form. To this point all is good.

On the AddEditClient form there is only one button ("Finished" button). If they were editing an existing client I want it to return them to the same record on the client form and making sure to display the new data. If they added a new client then I want it to display that new client on the client form. If selected the new client button but then did not add a new client and simply hit finished then it opens the client form on the first record of the client table. I have it half way working right.

My problem is that if they added a new client then it does not send them back to that client. I think I need a REQUERY statement... but it seems that no matter where I put it, it breaks my opening of the correct record and then starts sending me back to the first record of the client table. My current code for the "Finish" button on the AddEditClients form is below. There is some extra stuff in there b/c I have been playing around with this for a day or two now.

Where does the requery statement go (and what is the proper syntax)? (or if this is a bad way to do this... how am I "suppose" to do it?) I had toyed around with closing one form before opening the other but then I was unable to pass back and forth my client id (key index number). As it stands now, I can not get my data refreshed (mainly a problem if a new client was added). If I put in a requery statement then I lose my position on the Client Form. So now the user would have to search for the client again. I feel like I am running in circles.

Client Form ---> points to Client Table but is essentially read only
AddEditClient Form ---> points to same Client Table but has full access
ClientK_ID ---> the key index for the Client Table... the field I am trying to use to navigate the tables from the two forms.


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Clients"
If Me![ClientK_ID] > 0 Then
DoCmd.Close acForm, "AddEditClients", acSaveYes

Else
DoCmd.Close

End If


Basically I just want to be on a client... click an "edit" button to change their info. Then click a "finish" button and return to a mostly read only screen for that client. Or if I need to add a new client... click an "add" button... add a client then click "finish" and open that newly added record as mostly read only.

Unfortunatly I can't do this as a mode change... because on the Client form there are a few fields that are not read only.

Please help me. Thanks.

View 13 Replies View Related

Requery

May 29, 2006

I have a form which consists of an unbound combo box and two subforms. Now i would like that when i will select a value from the combo box, the two subforms will display the related records based on the combo's selected value.

What is the correct syntax to requery the subforms, after i select the value from the combo box?

View 3 Replies View Related

Requery

Mar 7, 2008

Hi, i need to requery a sub form from another sub from but cant for the life of me get it to work,..

Ive been testing this in a command button, but will eventually put it in an after update.

Main form is - Frm_18_Receipts

Sub form i need to Requery - Frm_39_Last_GRN
Field name in need to Requery is - Next GRN

The sub form i will execute the requery from is - Frm_19_Receipts_to_Warehouse

Expression builder from the sub form i want to execute from gives me

Code:Forms![Frm_18_Receipts]![Frm_39_Last_GRN].Form![Next GRN].Requery

Thanks AOG

View 8 Replies View Related

Requery Forms

Apr 19, 2006

Hi All.

I have been reading a earlier post regarding requerying forms


Forms are displayed on other form by means of a SubFormControl. It is the name of the SubFormControl that is needed. This is often the same as the SubForm but it is *not* a requirement. In your case you will be using two SubFormControl names, one nested within the other. Just for the record, you Requery forms and not fields.

How do you find out the name of the SubFormControl. I am trying to refresh sub forms and I am trying to use the following code.

Private Sub Form_AfterUpdate()
Forms!MainFormName!SubFormControl.Form!SubSubFormC ontrol.Requery
End Sub

I have 2 forms, "frmMainClient" and a subform "frmjob" and I have a command button on the "frmJob" which brings up a pop up form " frmJobNew". I fill out the fields and save via a command button.

When I look at the "frmJob" the new record I have entered is not there. It is there if I close all the forms and then open them again.

I know I need to requery the forms but I am not too sure how this is done.

Many thanks in advance.

View 1 Replies View Related

Requery: Not Working

May 29, 2006

I am trying to recreate (with many changes) a database that I have previously made, but the requery macro is not working. On my previous database, I typed the following in the row source:

SELECT [sub-activity].[Sub-Activity ID], [sub-activity].[Sub-Activity Name], [sub-activity].[Activity ID] FROM [sub-activity] WHERE ((([Combo23])=[sub-activity].[Activity ID]));

Now when I type it in my new database, the WHERE part of the statement is causing nothing to appear in my combo box. Does anyone know why that would be and what I can do to fix it? Thanks so much. :)

View 1 Replies View Related

Requery A SubForm

Jun 21, 2007

Hi,

I want to requery a SubForm using the on Click event of a combobox that is located on the main form. I used this code below, but it does not work.

Forms![frmSite]![subRoadsConstructionConsent].Requery

Any suggestions please,
B

View 6 Replies View Related

Requery Not Working??

Sep 28, 2005

I have an "On Double Click" code in the second Combo box of a cascading combo box set. The code below works fine on a normal Combo Box, but for some reason the Requery statement doesn’t seem to have any effect in this instance. The data that has been entered into "FRM_DelPoint" does not appear (in the second Combo box [Combo18]) unless the First combo box in the set is changed :mad:

What have I got wrong?


Private Sub Combo18_DblClick(Cancel As Integer)
On Error GoTo Err_combo18_DblClick
Dim lngcombo18 As Long

If IsNull(Me![Combo18]) Then
Me![Combo18].Text = ""
Else
lngcombo18 = Me![Combo18]
Me![Combo18] = Null
End If
DoCmd.OpenForm "FRM_DelPoint", , , , , , acDialog
DoCmd.GoToRecord , "FRM_DelPoint", acNewRec
Me![Combo18].Requery
If lngcombo18 <> 0 Then Me![Combo18] = lngcombo18

Exit_combo18_DblClick:
Exit Sub

Err_combo18_DblClick:
MsgBox Err.Description
Resume Exit_combo18_DblClick
End Sub

View 2 Replies View Related

Requery SubForm

Jan 26, 2005

I'm trying to requry a sub form based either or both text boxes. I need help with the code. I'm trying to rewrite something from a sample but can't seem to get it to use the criteria. It does requery though.

Private Sub cmdSearch_Click()
Dim sCriteria As String
sCriteria = "WHERE 1=1 "



If Me![Search] <> "" Then
sCriteria = sCriteria & " AND MedicalRecordsUpdating.SerialNumber """ & Search & """"
End If

If Me![SearchEvent] <> "" Then
sCriteria = sCriteria & " AND MedicalRecordsUpdating.Event """ & SearchEvent & """"
End If



Forms![RecordManagment]![FrmMedicalRecordsUpdating].Form.Requery

End Sub
Can some one steer me in the right direction

View 5 Replies View Related

Another Refresh / Requery

Jun 12, 2005

Hi all

I am sorry if this has been asked already a million times already but I could not find any relavant information in the time I had.

I have a requery / refresh problem.

I have a Customers form showing all customers, I also have a NewCustomer form for adding new customers.

On the Customer form, on activate I have me.refresh

On the NewCustomer form I have in the onclose,

If IsLoaded("Customers") Then
Forms!Customers.Requery

These work well however if Customers is open and I enter a new record in the New Customer Form, then view the Customer form again the new record is not shown.

I can however click back on the NewCustomer from then straight back to Customers and Hey Presto it appears

Any clues as to what I need to do to update the form?

Thank you in advance for your help

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved