If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Inserting Data from form into table
I am trying to populate a table from a form that I am pulling information in
from other tables. I am trying to get it when I enter the date that it will insert the information into the table. I am getting an errror (There was an error adding the record.3001, Arguments are of the wrong tyype, are out of acceptable range, or are in conflict with one another). I have check the spell and the names in my module and every thing seems to be ok. Could somebody please help me firgure out why I am getting this error. Below is my Module: Private Sub dated_AfterUpdate() Dim sql As String Dim rsAdd As New ADODB.Recordset On Error GoTo DbError 'Assign updatable cursor and lock type properties. rsAdd.CursorType = adOpenDynamic rsAdd.LockType = adLockOptimistic 'Opening recordset object rsAdd.Open "tbl_Issued", remoteConnection, , , adCmdTable With rsAdd ..AddNew !ID = Me.ID !Commodity = Me.txt_comm !Trailer_no = Me.txt_Trl_no !county = Me.txt_county !driver = Me.txt_driver !Web_EOC = Me.txt_eoc !D_Date = Me.dated ..Update ..Close End With MsgBox "Record Added.", vbInformation '‘Close the form-level Recordset object and refresh '‘it to include the newly updated row. 'rsAdjustors.Close 'SetRecordset Exit Sub DbError: MsgBox "There was an error adding the record." _ & Err.Number & ", " & Err.Description End Sub Thanks! |
#2
|
|||
|
|||
Inserting Data from form into table
Could somebody please help me firgure out why I am getting this error.
I think that problem is that all control values are stored as variants and when you have tabel where all fields have defined data type, before inserting value you have to convert it to proper datatype. Try to debug your your code and see where the error occours, which value causes error. Then try to convert this value to proper datatype. Regards, Sebastian |
#3
|
|||
|
|||
Inserting Data from form into table
From your description, it sounds like you are trying to:
* gather information from some tables, and * duplicate that information in another table If so, why?! You might do something like that if you were using Excel... but Access is NOT a spreadsheet. If you'll provide a more specific description of what data you have and what business need you are trying to solve, folks here may be able to offer more specific suggestions. Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "jrp444" wrote in message ... I am trying to populate a table from a form that I am pulling information in from other tables. I am trying to get it when I enter the date that it will insert the information into the table. I am getting an errror (There was an error adding the record.3001, Arguments are of the wrong tyype, are out of acceptable range, or are in conflict with one another). I have check the spell and the names in my module and every thing seems to be ok. Could somebody please help me firgure out why I am getting this error. Below is my Module: Private Sub dated_AfterUpdate() Dim sql As String Dim rsAdd As New ADODB.Recordset On Error GoTo DbError 'Assign updatable cursor and lock type properties. rsAdd.CursorType = adOpenDynamic rsAdd.LockType = adLockOptimistic 'Opening recordset object rsAdd.Open "tbl_Issued", remoteConnection, , , adCmdTable With rsAdd .AddNew !ID = Me.ID !Commodity = Me.txt_comm !Trailer_no = Me.txt_Trl_no !county = Me.txt_county !driver = Me.txt_driver !Web_EOC = Me.txt_eoc !D_Date = Me.dated .Update .Close End With MsgBox "Record Added.", vbInformation ''Close the form-level Recordset object and refresh ''it to include the newly updated row. 'rsAdjustors.Close 'SetRecordset Exit Sub DbError: MsgBox "There was an error adding the record." _ & Err.Number & ", " & Err.Description End Sub Thanks! |
#4
|
|||
|
|||
Inserting Data from form into table
You are probably right except I do not know how to make the debug mode work
when I am in the form. It will not run the module in module mode. Also, how to change the data type in the module. "sweet_dreams" wrote: Could somebody please help me firgure out why I am getting this error. I think that problem is that all control values are stored as variants and when you have tabel where all fields have defined data type, before inserting value you have to convert it to proper datatype. Try to debug your your code and see where the error occours, which value causes error. Then try to convert this value to proper datatype. Regards, Sebastian . |
#5
|
|||
|
|||
Inserting Data from form into table
I have a form that indiviuals will fill in that uses combo boxes and other
data that is needed and I want to take this information an put it into a table that I can use to run other macros and reports. "Jeff Boyce" wrote: From your description, it sounds like you are trying to: * gather information from some tables, and * duplicate that information in another table If so, why?! You might do something like that if you were using Excel... but Access is NOT a spreadsheet. If you'll provide a more specific description of what data you have and what business need you are trying to solve, folks here may be able to offer more specific suggestions. Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "jrp444" wrote in message ... I am trying to populate a table from a form that I am pulling information in from other tables. I am trying to get it when I enter the date that it will insert the information into the table. I am getting an errror (There was an error adding the record.3001, Arguments are of the wrong tyype, are out of acceptable range, or are in conflict with one another). I have check the spell and the names in my module and every thing seems to be ok. Could somebody please help me firgure out why I am getting this error. Below is my Module: Private Sub dated_AfterUpdate() Dim sql As String Dim rsAdd As New ADODB.Recordset On Error GoTo DbError 'Assign updatable cursor and lock type properties. rsAdd.CursorType = adOpenDynamic rsAdd.LockType = adLockOptimistic 'Opening recordset object rsAdd.Open "tbl_Issued", remoteConnection, , , adCmdTable With rsAdd .AddNew !ID = Me.ID !Commodity = Me.txt_comm !Trailer_no = Me.txt_Trl_no !county = Me.txt_county !driver = Me.txt_driver !Web_EOC = Me.txt_eoc !D_Date = Me.dated .Update .Close End With MsgBox "Record Added.", vbInformation ''Close the form-level Recordset object and refresh ''it to include the newly updated row. 'rsAdjustors.Close 'SetRecordset Exit Sub DbError: MsgBox "There was an error adding the record." _ & Err.Number & ", " & Err.Description End Sub Thanks! . |
#6
|
|||
|
|||
Inserting Data from form into table
I found that the following line gives me this error:
rsAdd.Open "[Issued]", remoteConnection, , , adCmdTable The Issued is the table that I want to put the information into. "sweet_dreams" wrote: Could somebody please help me firgure out why I am getting this error. I think that problem is that all control values are stored as variants and when you have tabel where all fields have defined data type, before inserting value you have to convert it to proper datatype. Try to debug your your code and see where the error occours, which value causes error. Then try to convert this value to proper datatype. Regards, Sebastian . |
#7
|
|||
|
|||
Inserting Data from form into table
Bear in mind that you don't need to have a table with data laid out for your
report. One of the many nice features of a relational database like Access is that you can use a query to join related tables, collecting the data you need, then basing a report on that query, rather than on a table. Good luck! Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "jrp444" wrote in message ... I have a form that indiviuals will fill in that uses combo boxes and other data that is needed and I want to take this information an put it into a table that I can use to run other macros and reports. "Jeff Boyce" wrote: From your description, it sounds like you are trying to: * gather information from some tables, and * duplicate that information in another table If so, why?! You might do something like that if you were using Excel... but Access is NOT a spreadsheet. If you'll provide a more specific description of what data you have and what business need you are trying to solve, folks here may be able to offer more specific suggestions. Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "jrp444" wrote in message ... I am trying to populate a table from a form that I am pulling information in from other tables. I am trying to get it when I enter the date that it will insert the information into the table. I am getting an errror (There was an error adding the record.3001, Arguments are of the wrong tyype, are out of acceptable range, or are in conflict with one another). I have check the spell and the names in my module and every thing seems to be ok. Could somebody please help me firgure out why I am getting this error. Below is my Module: Private Sub dated_AfterUpdate() Dim sql As String Dim rsAdd As New ADODB.Recordset On Error GoTo DbError 'Assign updatable cursor and lock type properties. rsAdd.CursorType = adOpenDynamic rsAdd.LockType = adLockOptimistic 'Opening recordset object rsAdd.Open "tbl_Issued", remoteConnection, , , adCmdTable With rsAdd .AddNew !ID = Me.ID !Commodity = Me.txt_comm !Trailer_no = Me.txt_Trl_no !county = Me.txt_county !driver = Me.txt_driver !Web_EOC = Me.txt_eoc !D_Date = Me.dated .Update .Close End With MsgBox "Record Added.", vbInformation ''Close the form-level Recordset object and refresh ''it to include the newly updated row. 'rsAdjustors.Close 'SetRecordset Exit Sub DbError: MsgBox "There was an error adding the record." _ & Err.Number & ", " & Err.Description End Sub Thanks! . |
#8
|
|||
|
|||
Inserting Data from form into table
I do know that but I am trying to do this from a form so others can fill it
in and see what they have done. "Jeff Boyce" wrote: Bear in mind that you don't need to have a table with data laid out for your report. One of the many nice features of a relational database like Access is that you can use a query to join related tables, collecting the data you need, then basing a report on that query, rather than on a table. Good luck! Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "jrp444" wrote in message ... I have a form that indiviuals will fill in that uses combo boxes and other data that is needed and I want to take this information an put it into a table that I can use to run other macros and reports. "Jeff Boyce" wrote: From your description, it sounds like you are trying to: * gather information from some tables, and * duplicate that information in another table If so, why?! You might do something like that if you were using Excel... but Access is NOT a spreadsheet. If you'll provide a more specific description of what data you have and what business need you are trying to solve, folks here may be able to offer more specific suggestions. Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "jrp444" wrote in message ... I am trying to populate a table from a form that I am pulling information in from other tables. I am trying to get it when I enter the date that it will insert the information into the table. I am getting an errror (There was an error adding the record.3001, Arguments are of the wrong tyype, are out of acceptable range, or are in conflict with one another). I have check the spell and the names in my module and every thing seems to be ok. Could somebody please help me firgure out why I am getting this error. Below is my Module: Private Sub dated_AfterUpdate() Dim sql As String Dim rsAdd As New ADODB.Recordset On Error GoTo DbError 'Assign updatable cursor and lock type properties. rsAdd.CursorType = adOpenDynamic rsAdd.LockType = adLockOptimistic 'Opening recordset object rsAdd.Open "tbl_Issued", remoteConnection, , , adCmdTable With rsAdd .AddNew !ID = Me.ID !Commodity = Me.txt_comm !Trailer_no = Me.txt_Trl_no !county = Me.txt_county !driver = Me.txt_driver !Web_EOC = Me.txt_eoc !D_Date = Me.dated .Update .Close End With MsgBox "Record Added.", vbInformation ''Close the form-level Recordset object and refresh ''it to include the newly updated row. 'rsAdjustors.Close 'SetRecordset Exit Sub DbError: MsgBox "There was an error adding the record." _ & Err.Number & ", " & Err.Description End Sub Thanks! . . |
#9
|
|||
|
|||
Inserting Data from form into table
On Thu, 18 Mar 2010 13:32:06 -0700, jrp444
wrote: I have a form that indiviuals will fill in that uses combo boxes and other data that is needed and I want to take this information an put it into a table that I can use to run other macros and reports. Do you have some specific reason not to use a form *bound to the table*, so Access will do all the work for you and not need any code at all? -- John W. Vinson [MVP] |
Thread Tools | |
Display Modes | |
|
|