Help With Combobox Updating Subform Code...
Aug 14, 2006
Hi well baisically the title explains the dilemma... I have a combobox in which the user selects an item and this updates the subform depending on the selection. However when i make a selection i get the following error:
Rumtime error '2101':
The setting you entered isnt valid for this property.
I understand what its telling me, however i cant seemed to find within the code where i have gone wrong, so heres the code:
Private Sub Combo4_AfterUpdate()
UpdateSubform
End Sub
Private Sub UpdateSubform()
Dim strSQL As String
Dim varWhere As Variant
varWhere = Null
strSQL = "SELECT * FROM Sub_qry_CostCentre"
If (Me.Combo4 > 0) Then varWhere = " WHERE (CostCentre = " & Me.Combo4 & " )"
' MsgBox (strSQL & varWhere)
Me.Sub_frm_CostCentre.Form.RecordSource = strSQL & varWhere
Me.Sub_frm_CostCentre.Form.Requery
End Sub
Private Sub Form_Open(Cancel As Integer)
UpdateSubform
End Sub
Anyhelp will be much appreciated, i have been stuck on this issue for a number of hours and is becoming increasingly frustrating..
thanks
View Replies
ADVERTISEMENT
Jun 11, 2005
Hello guru's, I've searched the complete forum for the answer but I just can't find it. I've got a main form with 2 comboboxes on it. The first one filters the second one. What I need now is the 2nd combobox to filter the SubForm. I've tried to add a subform with the wizard but then it shows the complete table instead of only the ones selected in the second combobox.
I've got 3 tables: 1 for classes, 1 for students and 1 for the attendance.
The 1st combobox selects the class, the second one selects the student.
The 3rd table is used to enter absences (date, time, teacher etc) and it should appear in the subform when the student is selected.
Can anyone please give me a little advice? Thanks heaps in advanced! Sebastian.
View 5 Replies
View Related
Jul 17, 2013
I have a mainform in access with a subform (continous form mode). The subform's source is a query that has a criteria parameter that gets the values from a combobox in mainform.(list of projects) Combobox name= cmbProject
It works fine for some records (old records), so when I migrate new data into the table the comboxbox display the new data but when I select the record to be dispayed on the subform, the record or data is not in the subform, so the record is in blank.
View 1 Replies
View Related
Dec 16, 2014
I have a form that has combo boxes and text fields (as well as sub forms). There is also a button linked to some code that says'
Private Sub cmdQuote_Click()
'Creates quote date and prints quote
Me.QuoteDate = Now()
Me.cbAgentID.Requery
DoCmd.OpenReport "Quote", acViewPreview, , "BookingID = " & Me.BookingID
End Sub
When the button is pressed the QuoteDate field (it is bound) should be be populated, but unfortunately it is not. I have played with refresh and requery but cannot derive a solution.
View 1 Replies
View Related
Mar 27, 2006
sorry if this q has already been asked, but i couldnt find what im looking for after searching..
i have a main form. there is a combo box that is that is bound to tblSupplierDetails. this combox displays the records stored in tblSupplierDetails fine. now beside this combobox i have a hyperlink that opens a subform called 'subfrmAddNewSuppliers'. this subform works correctly - ie. when details are entered here, they are stored in tblSupplierDetails
my prob is that if the user adds new supplier details via the subform, these details do not appear in the combo box for the user to select when they are returned to the main form.. they appear if the form is restarted
Ive inserted the statesment Me.ComboBoxName.Requery (with ComboBoxName ammended) into the event procedure for After Update for the combobox.
however, with this the new details which are added via the subform are replacing the previously added record - so theres only ever one record in tblSupplierDetails.. can someone pls help me with this?
View 7 Replies
View Related
Jun 8, 2006
I tried looking through the threads to find something that is relevant to my situation.
I am having trouble with a form where i need to select a name in one combobox and a month in another and then upon which a subreport displays the records for that name and month on a subreport which can then be added extra records or old records edited.
Does anyone know how to do this or can maybe just give me some code or point of reference to do this. I have tried but all attempts return no results.
Any help is much appreciated. Thx
Frans
View 1 Replies
View Related
Jul 15, 2005
I have a combobox that displays information about a current record on a form (much like a subform would show all information related to a certain record). So for example, there is a user and the combobox would list all the users applications. Now, when the record is changed (via the navigation buttons) I want the combobox to requery, but I don't know where the query should go. I tried putting the requery under the primary key's afterupdate method, but no go.
Can anyone think of a solution? Do you understand my problem?
Thanks in advance.
View 3 Replies
View Related
Aug 18, 2005
HI,
I have an input form on which I have a combobox.
The user can choose from the list of products. However, I want to use this input in a code and I need the productid to work with in the code. How can I arrange it that when the user selects, they can see the name of the product and the id (not necessarily), but once the input is chosen only the id serves as input and thus in my code I only use the id ( number)???
Stacey
View 2 Replies
View Related
Dec 24, 2006
I have this code to update my combo list when NewData is entered. NewData is not updating in the cbo box. I am new and still learning. Please help.
Private Sub POC_NotInList(NewData As String, Response As Integer)
On Error GoTo cboPOC_NotInList_Err
Dim intAnswer As Integer
Dim strSQL As String
intAnswer = MsgBox("POC " & Chr(34) & NewData & _
Chr(34) & " is not currently listed." & vbCrLf & _
"Would you like to add it to the list now?" _
, vbQuestion + vbYesNo, " POC")
If intAnswer = vbYes Then
strSQL = "INSERT INTO MARK20A([POC]) " & _
"VALUES ('" & NewData & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
MsgBox "The new POC has been added to the list." _
, vbInformation, "POC "
Response = acDataErrAdded
Else
MsgBox "Please choose a POC from the list." _
, vbInformation, " "
Response = acDataErrContinue
End If
View 4 Replies
View Related
Jun 14, 2015
I have a basic form linked with a subform inside of it. The main form has a list of customers in a combobox and the subform lists all the things they have ordered from us. This all works perfectly fine, I can add data to the list of things ordered and it's ok.
I decided instead of using a whole extra form to add customers I'd just have a not in list event and allow users to add customers through there, bit more intuitive and cut down on forms.
It works to certain extent except one small problem, if I add a customer I have to close and reopen the form to be able to add/remove data from them in the subform. If I leave the form open and try to enter in data in the subform immediately it just shows whatever customer I had last on the combobox and adds it to the last customer as well.
It works perfectly fine if I reopen it so I thought it was some kind of query or update snafu but all the VBA code examples I found don't seem to do anything. Not exactly sure where to go from here.
PHP Code:
Private Sub cboDept_NotInList(NewData As String, Response As Integer)
    Dim oRS As DAO.Recordset, i As Integer, sMsg As String
    Dim oRSClone As DAO.Recordset
    Response = acDataErrContinue
    If MsgBox("Add dept?", vbYesNo) = vbYes Then
        Set oRS = CurrentDb.OpenRecordset("tblDepartments", dbOpenDynaset)
[Code] .....
View 6 Replies
View Related
Oct 31, 2013
Right now I have a subform with a combobox that pulls it's data from a table. I want the user to either select an existing item or type in a new item and have a macro create the new table row. What I have right now works in the sense that it prompts the user if they want to creat a new item and the new item is created (and I can see it in the combobox list), but I'm still getting an error saying that the item does not exist in the table forcing the user to manually select the newly created list item they just typed in.
Code:
Private Sub MaterialCostCode_NotInList(NewData As String, Response As Integer)
Dim rst As DAO.Recordset
'Update value list with user input.
On Error GoTo ErrHandler
Dim bytUpdate As Byte
[Code] ....
It appears that the new item doesn't always show up automatically and requires the form to be refreshed, so now I need to figure out how to get it to consistently appear right away without a refresh.
View 3 Replies
View Related
Jul 24, 2014
This DLookUP works correctly...
UNDER CONTROL SOURCE:
=DLookUp("[First Name]","Contacts","[Combo378]='" & [Forms]![PROFILE]![Combo378] & "'")
but when a I want to close the form, display the error:
You must enter a value in the Profile.First Name
I junt need the way to update the field in the new table...
View 6 Replies
View Related
Feb 11, 2014
I am having trouble figuring out the method to automatically update some fields in SubForm from 2 other SubForms.I have attached 2 pics, the first GradeEntry1 shows what the tblTopic_Class_Grade form looks like after I manually enter everything into it. GradeEntry2 is what the form looks like when I fill out the Form starting at the top.
I'd like the tblTopics_Class_Grade form auto-populate the TrainingClassID (it currently does this), TopicClassID, StudentID, TrainingTopicID based off the entry from the above forms.My end goal is that I need to have a grade for each student on each training topic for each class. Like:
Class1-Student1-Topic1-GradeX
Class1-Student1-Topic2-GradeX
Class1-Student2-Topic1-GradeX
Class1-Student2-Topic1-GradeX
View 6 Replies
View Related
Mar 11, 2014
I have a folder in which there are PDF files stored. Now in the Form, there is a combobox and I want the code so that when a Form is loaded then add all those PDF file names(only first 9 letters of that) in the combobox.
e.g if the PDF file name is ABCDE1990-YYY then add ABCDE1990 in the combobox. So if there 10 PDF files in the folder then add 10 names in the combobox.
View 5 Replies
View Related
Oct 27, 2014
I am designing a nomination form (web database so no vba macros can be used).
The form has 3 combo boxes: cboStaffName, cboLevel, cboNominee.
The form is bound to the tblSubmit table where the submissions are populated.
I used a select statement:SELECT Staff_List.Staff_Name FROM Staff_List; to populate the combo box for the Staff Name selection.
This is the select statement to populate the job level combobox:
SELECT Staff_List.Level, Staff_List.Staff_Name FROM Staff_List WHERE (((Staff_List.Staff_Name)=[forms]![frmtest]![cboStaffName]));
The select statement to populate the combobox for the nominee combobox:
SELECT Staff_List.Staff_Name FROM Staff_List WHERE (((Staff_List.Level)=[forms]![frmtest]![cboLevel]));
The problem is that the staff_name in the first combobox is still found in the nominee combobox which should not be because a staff cannot nominate self. There is a field in the Staff_List called YesNo that should be activated for each staff that is selected so that the select statement on the nominee combobox can be updated accordingly to remove items with the field "Active"
How to get the checkbox selected for each corresponding staff.
Sample of the database has been attached.
View 4 Replies
View Related
Jun 20, 2005
I have a form called NewRequisitions that had a combobox in which the users select the Supplier (name, address, shipping details). I created a button to open a subform called NewSupplier so that they can add a new supplier to the Supplier table as needed. My code works okay for the first "NewSupplier" entry - the table and combobox are both updated and the new supplier is available for selection in the dropdown list. However, when there is a 2nd record that needs a NewSupplier added the combobox list doesn't get refreshed. The record is added into the table okay but you can only view it if the NewRequisitions (main) form is closed and then reopened.
Here is the code in my subform:
Private Sub Form_Close()
If CurrentProject.AllForms(NewRequisitions).IsLoaded Then
'save the record if there have been any changes
If Me.Dirty Then Me.Dirty = False
'requery combobox on other form
Forms!NewRequisitions!ComboSupplier.ReQuery
'yield to other events - and put the new list into use
DoEvents
End If
End Sub
-----------------------------------
Any assistance would be greatly appreciated!!!
View 7 Replies
View Related
Dec 5, 2013
On my main form I have a subform which holds two table values. [Roles] & [TrainLevel] example of this looks like this:
Plant Manager - T1
Assistant - T2
and so on for about 12 rows with different roles, each with different training levels.
This subform is then based on a query: [qryRoleEventWithRoles] which also looks at all the other selections, selected on the main form.
eg. User selects a training course on the main form, this then changes the subform and shows what level of training each role requires training in, T1, T2 etc..
All this has been working fine for months, almost a year. Each selection on the subform is based on using two combo boxes [Role] & [TrainingLevel] these are both setup on the subform and using the autonumber field, RolesID and TraininglevelID from two separate tables.
Like I say, this has been working fine. Now, all of a sudden, they've stopped working and telling me I can't change the valve because there bound to an autonumber value. or something like that.
View 3 Replies
View Related
Nov 26, 2013
I currently have a form with a combobox that I want to use to control a subform that I have inserted. Both the parent form and the subform are pulling data from a different table. From the combobox, I want the user to be able to choose a persons name, and then the subform will display each project that the person has worked on based on the name that has been chosen. The reason that I have a subform is so that the user is able to click through projects that pertain to a certain employee. I have the master fields and child fields linked on the employees name as there are not to many employees and the names are all unique.
View 3 Replies
View Related
Dec 4, 2012
I've go a subform with 2 comboboxes. It's a datasheet view.
The combobox controls are called cmb1 and cmb2 for the sake of this...
cmb2 is dependent on cmb1. So when you select a certain value in cmb1, cmb2.rowsource should get updated to use a certain table.
But the kicker is that this should be on a per row basis. So if on row 1 of the subform datasheet you set
cmb1=Manager, cmb2.RowSource should get set to 'tblManagers'.
Then on the next row, cmb1 is set to Directors, cmb2.RowSource should get set to tblDirectors.
But the cmb2.rowsource on row 1 is still set to tblManagers.
View 2 Replies
View Related
Mar 1, 2006
I have a customer subform on page 2 of my inspection log. A combo box at the top allows the user to lookup customers based on name. My problem is after I enter a new customer and part number into the database it shows up in my combo box but I cannot get my two underlying subforms to pull up any information on it unless I close out the form and re-open it. here is a copy of my database and the code I am using for my combo box after update event. You would think the “requery” action fro the subforms would allow me to pull new information with out closing and reopening the form.
Private Sub Combo4_AfterUpdate()
Me.QuerytblSpecTable_subform.Requery
Me.QuerytblPartNumbers_subform2.Requery
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[customer] = '" & Me![Combo4] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
End Sub
Sample included
View 5 Replies
View Related
Jun 21, 2005
I have this form where there's mention of CompanyID
In a subform, I have the information about all the contacts of this Company. In order to see full detail information for a particular contact (of that particular Company) I have a Combobox with a query.
At least: that's the whole idea. Unfortunately it doesn't work in Access:
SELECT Contact.ContactID, Contact.Name
FROM Contact
WHERE ((Contact.CompanyID)=(Me!frmCompany![ContactID]));
Can any help me? I need to do more of the sorts of queries... and I can't figure it out how to use values from forms and parent-forms.
Any help is appreciated,
Jazz
View 1 Replies
View Related
Nov 9, 2005
plz help me how to do it...
plz look at tables
i have "monthyear" & "partno/details and month" table
i cant open all part that have same month at table monthyear...
but i can open n view customer that bought same part at partno/details...
then i cant create form from table Monthyear..i want to create form as form "test"
plz help me...
am i need a coding?
can u show me the coding?
i'm new...plz..
ahh. cant post my DB....my db size to big...700kb after zip
cant i post screenshot? :confused:
View 1 Replies
View Related
Aug 18, 2006
I am running into a problem with just one form in my database. I was getting the error 'Can't build a link between unbound forms'. After searching here and elsewhere the solution is/might be to type the linked fields into the child and master proprty fields. However when I do that I still can't get this form to work. Would anybody please take a look at the file attached - I trimmed it down to two tables with a few records and a form/subform.
I want to make a selection in the combo box and have the filtered results displayed on the form below - simple and I have done the same thing in the database elsewhere but I just can't see why it won't work here.
Thanks
Steve
View 3 Replies
View Related
Aug 19, 2006
I have a subform for a hotel list, I have a combobox on the subform that show the list of the hotels, what I need is to create some fields on the subform wich shows me all the details of the hotel as address, email, facilities once I have selected a hotel from the combo list.
How can I achieve this!
Thanks
Marco
View 7 Replies
View Related
May 3, 2015
So I have a Form (frmPositions) with a subform attached (fsubPosSkill).They are linked through Position ID frmPositions Record Source is qryPositionNeeds
Code:
SELECT tblPositionNeeds.PositionNeedsID, tblPositionNeeds.PositionID, tblPositions.Position, tblPositionNeeds.NeedsID, tblNeeds.NeedStatus
FROM tblPositions INNER JOIN (tblNeeds INNER JOIN tblPositionNeeds ON tblNeeds.NeedID = tblPositionNeeds.NeedsID) ON tblPositions.PositionID = tblPositionNeeds.PositionID;
It has two texts boxes on it [PositionID] and [NeedID]
fsubPosSkill Record Source is qryPositionSkills
Code:
SELECT tblPositionSkills.PositionSkillID, tblPositionSkills.PositionID, tblPositionSkills.SkillID, tblSkills.SkillName, tblPositionSkills.SkillValueID, tblSkillValue.SkillValue
FROM tblPositionSkills, tblSkills, tblSkillValue;
It has two combo boxes, cmbo1 and cmbo2.
cmbo1: control source is SkillID and Rpw Source is qrySkill
cmbo2: control source is SkillValueID and Row Source is qrySkillValue
when I open frmPositions, the subform shows only the combobox label in the header, there is no combobox that allows me to select Skill or Skill Value.
View 1 Replies
View Related
Apr 2, 2014
I have a main form that identifies a Client File: frmClientFile (Single Form)
On the main form is a subform for Cases: subfrmCases (Continuous form)
Also on the main form below the Cases subform is a tab control that contains additional subforms to view/update different aspects of a case: subfrmCaseClients (Continuous Form).
The way this operates is that the user first chooses a file using a combobox on frmClientFile.
The subfrmCases is linked to the main form (using the caseFileID) and filters correctly.
The subfrmCaseClients is then linked using some hidden text fields on the main form (using caseFileID, CaseID) and this filters correctly.
On subfrmCaseClients is a combobox (cboClientID) that I need to requery based upon the Case Row selected on subfrmCases.
I have tried numerous combinations of options to force the requery by trying to apply a macro on the following:
OnCurrent, OnSelectionChange, OnChange and AfterUpdate events to no avail.
If I hit F5 to refresh the entire page the combo box gets updated as expected.
How do I get the Requery to work programatically? Is this even possible?
View 2 Replies
View Related