Combo Box And Error 2147352567!
Jul 12, 2006
Hi,
I'm, getting an error when I run the following code, only on some records though (the same ones).
The code is used to take a result from a combo box, take the primary key from the combo selection, and use this to find a single record from the database. The the form displays this via textboxes set up for this purpose (prefixed with txt in the form code). It gernally does this successfully with most records, no problem, but some records throw up the following:
Run time error 2147352567 (80020009)
The value you entered isn't valid for this field
Code as below, error is highlighted in the debugger on the first textbox assignment (when I deleted this, it went on to throw the error up on the next textbox assignment in the code!):
Private Sub cmbClient_AfterUpdate()
Dim cmbString As String
Dim intStrLength As Integer
Dim intStart As Integer
Dim mySQL As String
Dim cnn1 As ADODB.Connection
Set cnn1 = CurrentProject.Connection
Dim myRecordSet As New ADODB.Recordset
myRecordSet.ActiveConnection = cnn1
myRecordSet.CursorType = adOpenKeyset
myRecordSet.LockType = adLockOptimistic
cmbString = cmbClient.Value
intStrLength = Len(cmbString)
intStart = InStr(1, cmbString, "*")
intStart = intStart + 1
cmbString = Mid(cmbString, intStart)
Debug.Print cmbString
mySQL = "SELECT TblCOMPANY.*, TblCONTACT.* " _
& "FROM TblCOMPANY INNER JOIN TblCONTACT ON TblCOMPANY.CompanyID = TblCONTACT.CompanyID " _
& "WHERE (((TblCONTACT.CompanyID)=" & cmbString & "))"
myRecordSet.Open mySQL
txtTitle = myRecordSet("Title")
txtForename2 = myRecordSet("forename")
txtSurname2 = myRecordSet("surname")
txtPosition = myRecordSet("position")
txtDept = myRecordSet("Dept")
txtTelNo = myRecordSet("TelephoneNo")
txtMobNo = myRecordSet("MobilePhone")
txtHomeNo = myRecordSet("HomeTelNo")
txtFaxNo = myRecordSet("faxnumber")
'txtURL = myRecordSet("URL")
txtemail1 = myRecordSet("email1")
txtemail2 = myRecordSet("email2")
'txtsource = myRecordSet("source")
txtsms = myRecordSet("sms")
txtBusName = myRecordSet("BusinessName")
txtBusType = myRecordSet("BusinessType")
txtAdd1 = myRecordSet("address1")
txtAdd2 = myRecordSet("address2")
txtadd3 = myRecordSet("address3")
txtAdd4 = myRecordSet("address4")
txtTownCity = myRecordSet("TownCity")
txtRegion = myRecordSet("Region")
txtPostcode2 = myRecordSet("Postcode")
txtEmployeeNo = myRecordSet("EmployeeNo")
txtSIC = myRecordSet("SIC")
txtSICDescription = myRecordSet("SICCategory")
txtTurnover = myRecordSet("Turnover")
Set myRecordSet = Nothing
Set cnn1 = Nothing
End Sub
View Replies
ADVERTISEMENT
Mar 30, 2005
I've got a form with Text boxes StartDate (datatype = Date / Time) and Interval (datatype = Numeric).
Both text boxes are bound controls.
I'd like to validate whether summing the StartDate with the Interval entered results in a calculated date, falling on either Saturday or Sunday.
If so, the Interval needs to be reset so that the calculated day will fall on the first Monday falling after the StartDate.
The code I've got so far results in an error:
Run-time error '-2147352567 (80020009):
The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Microsoft Access from saving the data in the field.
I can understand why this error is generated.
What I can't figure out is how to adapt the code.
The AfterUpdate event is no option as this is triggered too late...
BTW, I'm on Access2000
Here's the code I've got so far:
Private Sub Interval_BeforeUpdate(Cancel As Integer)
Dim Response
Dim strInterval As Integer
If Weekday(Me.Startdatum + Me.Interval, vbMonday) = 6 Or Weekday(Me.Startdatum + Me.Interval, vbMonday) = 7 Then
Response = MsgBox("Eerstvolgende klusdatum valt in het weekend, laten vallen op maandag?", vbYesNo)
End If
If Response = vbYes Then
strInterval = 8 - Weekday(Me.Startdatum, vbMonday)
Me.Interval = strInterval
Else
If Response = vbNo Then
Me.Undo
End If
End If
End Sub
Regards,
RV
View 1 Replies
View Related
Feb 8, 2005
I have 5 table (See attachment).
I also have a booking form, which is a combination of the other four tables. The client table is linked to the driver table, as one client is tutored by one driver. So i have created a combo box for both the client and driver, so when you select the client, you can only select the driver who is assigned to that client.
To do this i had to change the row source of the client combo to:
SELECT Client.DriverID, Client.ClientID, Client.Forename, Client.Surname FROM Client;
And create an After Update, Event procedure:
Private Sub cboClient_AfterUpdate()
Me.cboDriver.Requery
End Sub
I changed the row source of the driver combo to:
SELECT Driver.DriverID, Driver.Forename, Driver.Surname FROM Driver WHERE [DriverID]=[cboClient];
This works fine. I can select the client and the driver combo produces the result i want.
The Problem: I get this error msg- You cannot add or change a record because a related record is required in table 'Client'.
The client table contains both the ClientID and the DriverID, so there is a related record. Since the drop down list for the client combo, is related to the client table, i cant see why there is a problem. I hope someone can help, thank you in advance...
View 3 Replies
View Related
Aug 7, 2006
hi guys, i was wondering if you can help me, i have a text box and a combo box that needs to changed every time the user clicks on a contract in my contract combo box... but i keep getting this error and it goes to the end of the code and it says the value you entered isn't valid for this field....
Private Sub cboPMContract_Click()
Dim mysql1 As String
Dim mysql2 As String
Dim rs As DAO.Recordset
Dim rs2 As DAO.Recordset
mysql1 = "SELECT LOC.LOC_Number FROM LOC WHERE (LOC.Facility_Entity_Code='" & txtFEC.Value & "') and (LOC.PM_Contract_ID='" & cboPMContract.Value & "');"
mysql2 = "SELECT LOC.Status FROM LOC WHERE (LOC.LOC_Number='" & LOC_Number.Value & "')and (LOC.Facility_Entity_Code='" & txtFEC.Value & "') and (LOC.PM_Contract_ID='" & cboPMContract.Value & "');"
Set rs = CurrentDb.OpenRecordset(mysql1)
Set rs2 = CurrentDb.OpenRecordset(mysql2)
'it points here******
Me.LOC_Number = rs("[LOC_Number]")
Me.cboStatus.Value = rs2("[Status]")
End Sub
View 3 Replies
View Related
Jun 7, 2006
Can anyone tell me whats wrong with this line of code?
DoCmd.OpenReport "rptOverview", acViewPreview, , "WHERE [CarID] = " & Me.cboCar.Value
I'm getting a missing operator error (3075)
..its supposed to open a report based on what record the user selected from a combo box
thanks
View 2 Replies
View Related
Dec 11, 2005
Pleae take a look at the attached database, open frmUpdate and select an item in Group1.
I get a message box "Enter parameter Value" - Group1.
After I click OK, sometimes I get a run-time error, usually everything works fine until the form is reopened.
Can anyone see my problem.
thanks
Steve
View 3 Replies
View Related
Sep 7, 2006
Hi,
I have a form with various fields, some of which are normal data entry fields, others dynamically updating combo boxes.
My first field is a date field which defaults to today's date, the field following this is a growing combo box which requires some narrative to be entered. I have set up this combo box so as when data is entered into the combo box, the combo box will store it, allowing that entry to be used again. I achieve this with the Got Focus property Me.Refresh.
An error occurs when the user wishes to change the date from the default to another date. When I tab to the narrative field, Access informs me that the error occurs with the Me.Refresh property of the narrative field. I want to keep this property to allow me to update the combo box entries but I can't keep allowing this error to occur.
Does anyone know how I could solve this problem/get around it?
Thanks
Turbojohn
View 11 Replies
View Related
Oct 12, 2005
I have managed to set up a cascading combo box by following this guide:
http://support.microsoft.com/default.aspx?scid=kb;en-us;209576
I have two boxes - [BusinessUnit] and [Location]. When I load the form or select one of the [BusinessUnit] I get a box which prompts me to enter a paramter value - [BusinessUnitID]. If I just ok it without entering anything I get to the form and my location select box has the correct locations listed.
What have I done wrong and how do I get rid of this prompt?
Thanks
View 2 Replies
View Related
Sep 6, 2012
I am using a combo box to filter a 2nd form upon clicking a button. I posted on this topic the other month and was given some code that works. I am attempting to tweak it for another part of my database.I am receiving a Run-time error "3464': Data type mismatch in criteria expression.
DoCmd.OpenForm "Utilities Contacts", , , "[Utility] = """ & Me.Utility.Column(1) & """"
DoCmd.Close acForm, "Utility Menu"
View 4 Replies
View Related
Jun 7, 2015
error message I am getting when I click on my Duplicate Record button (created through the wizard).
I have two combo boxes on the main form that populates data when the user makes a selection from the combo box. First combo box populates project data and the second combo box populates equipment data. The form is working well with the two combo boxes populating the data into the main table.
Now I would like to add a duplicate record button to copy a record and paste the data as a new record. So, I added a duplicate record button using the wizard and I am receiving the following AfterUpdate error.
Run-time error 3020: Update or CancelUpdate without AddNew or Edit.
This is the code I am using to copy and paste a duplicate record:
Private Sub InputForm_DupRec_Button_Click()
On Error GoTo Err_InputForm_DupRec_Click
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdSaveRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPasteAppend
Exit_InputForm_DupRec_Click:
Exit Sub
Err_InputForm_DupRec_Click:
MsgBox Err.Description
Resume Exit_InputForm_DupRec_Click
It seems to be duplicating the data from the first combo box, but not the second one where it errors out.
View 1 Replies
View Related
Jun 12, 2013
tried following Microsoft example and several others but my problem comes up when I click on Group in Ticket list, I get a parameter value popup. I know I'm getting it from my Where statement that is supposed to setup the row source for Category. I tried using numbers and text but I messed up somewhere when it comes to the vba.
Me.cboCategory.RowSource = "SELECT DISTINCT Category.Categories FROM" & _
" Category WHERE GroupName = " & Me.cboGroup & _
" ORDER BY Category.Categories"
Me.cboCategory = Me.cboCategory.ItemData(0)
View 2 Replies
View Related
Sep 9, 2013
I am trying to populate a list box with an event after update in a combo box. I can get the formula to work using 2 criteria, the problem is i nee to add a third criteria. When I try to add it I get the run-time 13 error.
Here is the code I am trying to use:
Private Sub cboStatusRFQ_AfterUpdate()
Me.cboSupplier.RowSource = "SELECT DISTINCT [Consolidated_Master_Req_Pool.RFQ Contact] " & _
"FROM Consolidated_Master_Req_Pool " & _
"WHERE consolidated_master_req_pool.Complete = FALSE AND [Consolidated_Master_Req_Pool.RFQ Supplier] = '" & Nz(cboStatusRFQ.Value) & "'" And "[cosolidated_master_req_pool.Status] = '" & "[SUPPLIER_RFQ FOLLOW-UP]" & "'" & _
"ORDER BY [Consolidated_Master_Req_Pool.RFQ Contact];"
Me.cboSupplier = Null
End Sub
View 2 Replies
View Related
Oct 17, 2006
I am trying to pass parameters to my qury thru my combo selection. I keep getting this error "Data type mismatch criteria expression", does anyone have an idea why?
WHERE (((fShiftWorked([tblTimeLog].[timeStart])=[Forms]![frmOperatorWorkDone]![cboShift] Or IsNull([Forms]![frmOperatorWorkDone]![cboShift]))=True));
I have spent so much time onthis already and i am sick of it :mad:
Attached is my db. Please help me out here.
View 2 Replies
View Related
Jan 28, 2004
Hi,
Im new to asp and access and have been having this problem for serveral weeks.
Every couple of days, all the asp pages on my site that communicate with the database start having 500 internal errors. i turned off the "Show friendly error messages" and one page gave me this specific error:
Microsoft JET Database Engine error '80004005'
Unspecified error
/admin/submitlogin.asp, line 8
I have tried a million things and have no idea why this is happening. Im not sure what other information i should post in order to see the problem. Any help would be greatly appreciated. Thank you,
Patrick
View 3 Replies
View Related
Jul 13, 2012
How I can get rid of Disk or network error with error code 3043? What this error indicates.
View 4 Replies
View Related
Dec 6, 2005
hi all
i have the following peice of code ...
Private Sub NextApplication_Click()
On Error GoTo Err_NextApplication_Click
DoCmd.GoToRecord , , acNext
Exit_NextApplication_Click:
Exit Sub
Err_NextApplication_Click:
If Err.Number = 2105 Then
MsgBox "Cannot navigate to the next record. This is the last record."
Else
MsgBox Err.Description
End If
Resume Exit_NextApplication_Click
End Sub
but even when this error occurs nothing is being properly handled the way i specified - any ideas ?
View 3 Replies
View Related
Mar 31, 2006
Does anybody know what this error message refers to?
"Reserved Error (-1517); there is no message for this error."
It just started happening today, and I haven't even made any changes to the database. It occurs when I hit a button I have to run a macro.
the macro does the following:
1) Shows all records
2) Requery
3) ApplyFilter.
The Where Condition for the filter is:
Right([tblContracts].[JobNum],4)=Right([Forms]![FrmContProc].[txtFindJobNum],4)
The weird thing is that it only occurs if the Form window is taller than 1/2 of my viewable area. If the Form window is 1/2 the viewable area or shorter, it works OK. This was running fine earlier today, but about 4:00 pm (03/31/06) this started happening.
If anybody knows what this error means, or how to get rid of it (I really need to use this window in full-screen) then please let me know.
-Thanks, Sean
View 10 Replies
View Related
Aug 3, 2006
Okay, I'm kind of stumped here.I have a subform that has a button that sends a user to a "sibling" subform on another tab page, pass some information to ensure they are adding more details to the same records rather than creating two separate record.First time I programmed it, I got an error 3022 (keys cannot have duplicate values). I checked the query of the sibling subform and saw that the ID is from the one side table. I changed it so many table's foreign key is used. Second try, I got an error 3341 (there isn't a matching key in one side table).After some thinking, it also occured to me that I had set the query this way to allow addition of new record which wouldn't be possible if I had the query pulling the many side key, not the one side key.How do I get the subform to accept the ID that is being passed and create a new record using that ID?:confused:
View 5 Replies
View Related
Sep 1, 2014
Code:
Private Sub Consolidate_Click()
Dim temp As Variant
Excel.Application.Visible = True
temp = Dir(CurrentProject.Path & "Inputs")
Do While temp <> vbNullString
[Code] ....
From the second iteration its not picking the error.
View 5 Replies
View Related
Aug 5, 2013
I have several comboboxes (6) on my form.How to populate these comboboxes with values depending on selected value in previous combobox.
Example.Lets say that you select value "Audi" in combobox 1, then available values in combobox 2 should be "A4","A6","TT" etc. and if you selected "BMW" in combobox 1, then available values in combobox 2 should be "3-series", "5-series" etc...
View 1 Replies
View Related
Mar 31, 2014
I have a form that currently uses a "catch all" table for listing available equipment to choose from for an equipment field. I call it tblEquipment. What I want to do is to make it so when I type a name in (1 of 35) in one field of the current record, the record source for the equipment field immediately looks at a different table that has equipment available only for that name. To do this I plan on making 35 different tables with limited data originally found in tblEquipment. I would call these tblEquipment1, tblEquipment2, etc. I do not use a sub form, nor do I want to.
So my questions are:
1) can this be done
2)If it can be done, how can I do it?
View 3 Replies
View Related
Sep 24, 2005
Every form has an on error property.
Is it enough for error handling to code the on error property for each form?
With enough I mean error handling which lets you resume the program.
Ontherwise I have to code (or call a procedure) for each coded event which i wouldn't prefer
For instance now I'm putting error handling in each event but would consider it more efficient if it can be placed once in each form
Private Sub cmdReport_Click()
On Error GoTo Err_cmdReport_Click
Dim stDocName As String
stDocName = "rptOfme"
DoCmd.OpenReport stDocName, acPreview
Exit_cmdReport_Click:
Exit Sub
Err_cmdReport_Click:
MsgBox Err.Description
Resume Exit_cmdReport_Click
End Sub
View 3 Replies
View Related
Feb 1, 2006
Hello All,
I have been developing my database all one seems to be well exept for an error message which is attched.
If anybody can help me trap this error or offer some advice i would be greatfull.
Alastair
View 6 Replies
View Related
Aug 5, 2005
SQL Issue ...
ERROR: Runtime error 3061 - Too few parameters. Expected 1.
------------------------------------------------------------------------
Not sure how to work in the '* ROLL *' into this SQL statement. The query statement works fine ... I have tried different quotation methods ( Not Like " & " '
* ROLL * & ' " & " ) AND .... )
sql = "SELECT DISTINCTROW Sum(CDbl([Scrap Factor])) AS SumOFScrap FROM [RT: Signpro1: Costs] LEFT JOIN [DT: InventoryExtend] ON [RT: Signpro1: Costs].[Part Number] = [DT: InventoryExtend].[Part#] GROUP BY [DT: InventoryExtend].CategoryID, [DT: InventoryExtend].Description, [forms]![signpro sign estima parameters]![combo14] HAVING ((([DT: InventoryExtend].CategoryID)=30) AND (([DT: InventoryExtend].Description) Not Like '* ROLL *') AND (([forms]![signpro sign estima parameters]![combo14])=1));"
ANY HELP WOULD BE APPRECIATED ...
Cheers,
QTNM
View 14 Replies
View Related
Dec 18, 2006
hi guys i was wondering if you can help me this is my code: i have a main form with this code, this form contains a subform linked by the All_PricingID
Set rst = CurrentDb.OpenRecordset("tblAll_Pricing") 'main table
' adding data to the table
rst.AddNew
' Main table
rst!All_PricingID = Me.txtPricingID 'Main table pk
rst!MainContract_ID = Me.cmbMainContract 'combo box in parent form
rst!ItemNumber = Me.txtItem 'Main form text
rst.Update
'sub Table
Set rst2 = CurrentDb.OpenRecordset("tblPricing") 'sub table
For varItem = 0 To Me.lstsubContracts.ListCount - 1 'this is a list in the main form
'--- loop through all the items in the list box and create a new row in the subform for each subcontract in the listbox lstSubcontracts.
rst2.AddNew
rst2!ID = Me.All_PricingID 'sub table foreign key
rst2!SubContractID = Me.lstsubContracts.Column(0, varItem) 'sub table
rst2.Update
Next varItem
'--- close the tables
rst.Close
rst2.Close
Set rst = Nothing
Set rst2 = Nothing
the subform appears correctly with the rows i wanted added but i need the user to be able to edit a column in the subform for the rows just created (my form is on datasheet view). but everytime i move to cursor into the subform, i can't even scroll up and down.
i keep getting an error that says :
The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. (Error 3022)
but when i check my tables tblAll_Pricing and tblPricing , everything is inserted correctly according to my recorset above, do you know why this is happening? and why i am not able to edit my subform. my subform allowsedits and additions.
help!!
View 2 Replies
View Related
Oct 20, 2005
Hi everyone,
I have two combo boxes on the same form bound to a table. I want the contents of the next combo box to change based on the previous combo selection e.g
cboContinent cboCountry
Africa Zambia
Africa Congo
Africa South africa
Europe England
Europe Holland
If I choose Africa in cboContinent, I want to see only Zambia, South Africa and Congo under cboCountry and if I choose Europe I want to see only England and Holland
Thanks
Humphrey
View 1 Replies
View Related