Am I Missing Sumting? Listbox Requery Subform
Nov 13, 2005can 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
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
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:
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.
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"
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
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.
I have two sub forms on a main form.Subform 1 displays information which comes from a query, filtered using two combo boxes on the same form.The active record on the data sheet has two field values output to hidden text boxes on the form.
These text boxes then provide the values used for the query displayed on the 2nd sub form.When I highlight a new record in subform 1, the text box values change, but the values in sub form 2 do no.Which would be the best method to use to get this to requery?
All I am trying to do is get a subform to requery after choosing a name from a combobox on the subform itself, thus updating the records on the subform. The main form name is "BasicTestOneF" the subform name is "ICminiBasicF" and the combobox name is "Combo4"
I have the combobox requery on After Update, but I still get the "Enter Parameter Value" popup. I've spent the last hour and a half just trying to get this simple thing to work and have gone through I don't know how many sites and forum posts, tried every combination of VBA code I've found, and I still can't get it to work.
I have a main form that has two subforms, subform1 and subform2, both connected to the main form. When I enter data into a field in subform1 I want subform2 to requery and update to show the calculated results from the new or changed data in subform1.
I found that if I do a refresh it works when changing the data but not when entering a new line of data in subform1. I tried some code in the after update field of on subform1, but cannot seem to get anything to work.
Me.[subform2].Form.Requery
Does not work. It errors and says it cannot recognize subform2 as a field. I have tried a field name on subform2 but I still got the same error.
i have a main form with three sub forms on it. when i update subform 1 i want subform 2 and 3 to update..currently i have an after update event in a combo box subform 1
Code:
[Forms]![FRMDATESUM]![frmHOURSUMnowork].Requery
[Forms]![FRMDATESUM]![frmHOURSUM].Requery
when the user updates the combobox in subform one nothing happens to the other subforms until close and reopen main form
I have a main form with a couple of tabs, forms and subforms (see attachment). The problem is that when I click on one of the blue record navigators, I want the right subform to requery. I can't get that to function properly.
Until now I'm just using the Macro Builder and little to no VBA. There is a function Requery in the MB, but I keep getting error messages that the object doesn't exist or nothing happens at all.
I've read the page on Access mvps about linking to forms, but I'm still doing something wrong.
When I used some VB like:
Me.Parent!frmStagesPerLeerling2.Form.Requery
it did work, but I an into problems with setting the visibility of the navigation buttons (they should only show when there is more then one record in that subform).
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
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
I have a form that contains a subform, upon clicking the notes button a new form is presented. Upon saving data I want the form to requery the publishers sub form here is my attached code:
Private Sub buttonsave_Click()
DoCmd.Save
Forms!Publisher![Notes subform].SetFocus
Forms!Publisher![Notes subform].Requery
DoCmd.Close
End Sub
The for does not requery I have to move to the next record and come back to see the new updated notes. TIA
I'm having trouble updating a combo box automatically. I have a main form [Orders] containing a combo box with a list of Buyers. Inside this main form is also a subform, [Order Details], containing products to be ordered which is also selected by a combo box. However, each buyer has a different set of products. I tried filtering for only the products by a certain buyer but when I go to a new record, the product list remains the same according to the buyer on the first record when the form was opened. What do I need to do inorder to have only the products for the chosen buyer appear in the combo box when a buyer is selected in the main form?
View 5 Replies View RelatedI am a newbie to access and am having some difficulty with a subform. I have searched the forum, but could not find an exact match to my problem.
The following is a simplified version of my problem:
Tables: TSerialNumber, TLocation, TSubLocation(Location and SubLocation Fields)
Form: ServiceForm
SubForm: ServiceSubForm
Form and SubForm linked by SerialNumber
In the SubForm: I have 2 ComboBoxes: Location, SubLocation
Location - Row Source is the Table TLocation
SubLocation - Row Source is a Query of SubLocation relating to the Location
I need the SubLocation field to be requeried OnChange from the Location ComboBox.
If I use the subform as a form I can get this to work by using a macro to requery the SubLocation, but when I try to use it as a subform I get an ApplyFilter Error.
Thanks in advance for any help.
Hi there,
I hope someone can help... and i hope i can explain this properly.
Some background... I have a form which has a Global ID as one of the fields.
From this form another audit results form can be opened (on the click of a button) that shows the results of Audits based on this ID. The results of audits are in a flat un-normalised table(this is not an issue at this point)
On the top of the audit results is a textbox for the 'GID', the contents of which have been copied from the original form where the button was located. This process uses a macro.
OpenForm
Set Value
[Forms]![frm_Audit Result]![Audit Result GID]
=[Forms]![frm_Call Log]![txt_Global ID]
The audit results form has a subform which displays the result of a query based on the the value that is copied.
The txtbox displays the value fine, but the subform does not display the result of the query.
The query has number of fields but the criteria for filtering the correct ID's is:
[Forms]![frm_Audit Result]![Audit Result GID]
Its just that the subfrom does not display any result as soon as the audit results form is launched. If I alter the number in the text box and hit enter, the subform displays the correct results.
The subforms Record source is the query.
I've tried numerous ways around the problem with various attempt to update the query on various events, but have had no luck.
I guess i need to rerun the query and then refresh the subform once the main form has the GID copied over... but am not sure how to rerun the query and at what point/with which event?
Any pointers are much appreciated.
Hi. First off I want to say that these forums are a gold mine. You all do a great job. Keep it up!
I work at a University and keep a database of students. On the main form for the student, you select their name from a combo box and the whole form refreshes to show the data for your selection. There are four subforms that keep track of things like a questionnaire, career center visits, etc. The problem I am having is with the Career Center visits.
There is a button that allows you to make an entry into a log when they come into the career center. Clicking on it opens up a small window where you can put notes and with whom they spoke while they were here. Upon closing the window, it adds the entry to the log for that particular student. That all works great. Each student has their own log...all is good.
However, upon closing the window, the main form jumps back to the first student in the list. The entry is added to the correct student, but you must find the student from the combo box in order to see it. It is just annoying to have to do it and I would like to fix it. Can't figure out why it is doing it, though.
Any ideas? I would like it to add the entry to the student, and stay on their record.
Hi,
First post, but based on a long look-around, I'd say that if I can't find a solution here - there probably isn't one! :D And it's probably a simple one as well ...
My problem is the following:
I have setup a SubForm with two dropdowns - the second requerying based on what's selected in the first. It works like a charm when I open the subform by itself, the values update and everything. However, when I place this subform into another form it all of a sudden fails to register, and instead the "Enter parameter values" message comes up, with the seemingly correct Forms!SubForm!Value note. When I type in the value that I've just selected from the dropdown, the second dropdown updates correctly.
I know I must be overlooking something, but I feel I have checked everything I can - especially seeing as it works fine when run by itself.
Thanks for any help or advice!
"5itus
I have used the following command on a command button to requery my subform and it works as I planned. However, if I copy it to say,the OpenEvent for the same form, nothing happens. I'm obviously missing something here. [Forms]![Customers]![mysubform].Form.Requery
All help appreciated thanks
I have a subform that contains two combo boxes, 'cboPrimary_Source' and 'cboSecondary_Source'. When you select the primary source e.g. 'Direct Mail' a number of related options appear for selection in the secondary source combo box e.g. Letter, Email, Fax. When you open the subform only, this works just fine using the requery.
However, when you open the main form 'Prospects' where the subform sits it does not work. The primary source combo can be selected, but when you select the secondary source combo an error message appears 'Enter parameter value: Forms!Subdatasheet_Subform!cboPrimary_Source'.
The code used on the Subdatasheet_Subform is as follows:
Option Compare Database
Private Sub cboPrimary_Source_AfterUpdate()
Me!CBOSecondary_Source.Requery
Me!CBOSecondary_Source.SetFocus
End Sub
Private Sub Form_AfterUpdate()
Me!CBOSecondary_Source.Requery
End Sub
Private Sub Form_Current()
Me!CBOSecondary_Source.Requery
End Sub
Any suggestions would be gratefully received!
Hi,
I'm trying to requery a subform within a tab after I select from a combo box in the main form. Can anyone help?
Or just to simulate the "refresh" button click within a macro?
thanks
Jeff
I need to requery a subform from a third form and can't seem to get it to work.
frmForm1 has frmAddress as a subform. The button cmdReviseAddress opens the form frmUpdateAddress where all of my validation work is done and the new record is added.
However, the new address is not being displayed in the subform.
If I use the command
Forms![frmTest]![frmAddress].Requery
it works fine.
The problem is that I want to be able to frmAddress on any form, and need to pass the name of the main form (in this case frmForm1) as a variable.
If lsTemp = "frmForm1", the statement
Forms![lsTemp]![frmAddress].Requery (and every variation using brackets and quotes that I can think of) fails.
Any ideas?
Thanks!
Hi. Having a bit of a problem getting a subform to requery/refresh after running a query from a seperate form. The seperate form is acting as a 'search form' and running query qSearch.
I've tried various things (requery the form, subform etc) but here is the code I'm currently using:
Private Sub RunqSearch_Click()
DoCmd.OpenForm "Papers"
Forms.Papers.RecordSource = "qSearch"
Forms.Papers!Authors.Form.RecordSource = "qSearch"
Forms.Papers!Authors.Form!AuthorName.ControlSource = "qSearch.AuthorName"
Forms.Papers!Authors.Form.Requery
Forms.Papers.Requery
DoCmd.Close acForm, Me.Name
End Sub
The main form is requerying fine, but the subform isn't. Any help would be appreciated. Thanks
Apologies in advance for the basic nature of this, but in the past two years I have forgotten everything i ever knew!
I have two tables - Holders (holderID, name, current address) and Addresses (addressID, address1, city, etc)
current address is linked to addressID
I am trying to create a form (frmHolders) that shows the details from holders and pulls in the address using a subform (sfrmHolders)
On the main form I have used a combo box for current address so that it can be changed. What I want is for the address on the subform to refresh when the current address is changed in the combo.
I am using this:
Private Sub cboAddress_Change()
Me!sfrmHolders.Requery
End Sub
and it doesnt work
where did i go wrong?
thanks
chancer
I have a subform in a tab within a mainform. Within the tab there is a button to open a form to delete/add data to the subform. So upon closing this pop up form I want to update the subform to show what has been deleted or added, I have tried the various things to requery the subform but none of it seems to work, here is what I have tried;
Code:
Forms!frm_Capex_Submission!frm_CapexSignatures.Requery
I assumed this would work but evidently not...
I have also tried;
Code:
Forms!frm_Capex_Submission!frm_CapexSignatures.Form.Requery
and;
Code:
Forms!frm_Capex_Submission!frm_CapexSignatures.refresh