3001 Argument Error Invalid Run Time
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About runtime error 3001 Us Learn more about Stack Overflow the company Business Learn more about hiring run time error 3001 arguments are of the wrong type developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the run time error 10014 invalid argument Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Run-time error '3001': Invalid Argument when
Runtime Error 3001 Invalid Argument
creating a table in Access VBA up vote 1 down vote favorite 1 When creating a table in Access VBA using the following code: Set tbl = dbs.CreateTableDef("" & strTableName & "") I get the following error: Run-time error '3001': Invalid Argument. What causes this? vba ms-access access-vba ms-access-2010 share|improve this question asked Feb 25 '14 at 8:45 BFWebAdmin 2,11863166 add a comment| 1 Answer 1 active runtime error 3001 arguments are of the wrong type oldest votes up vote 1 down vote accepted The name of the table you're trying to create (in the above example expressed as strTableName) is not valid - it's probably either null or too long. The names of Access 2010 tables can be no longer than 64 characters. If strTableName is not null and has fewer than 64 characters, the above code will work perfectly. share|improve this answer edited Feb 26 '14 at 14:57 answered Feb 25 '14 at 8:45 BFWebAdmin 2,11863166 1 Or strTableName could be Null –4dmonster Feb 25 '14 at 9:52 @4dmonster - Yes, good point - in short, anything that creates an invalid table name would generate this error. –BFWebAdmin Feb 25 '14 at 10:08 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged vba ms-access access-vba ms-access-2010 or ask your own quest
Community Links Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to runtime error 3001 in vb6 Page... Thread Tools Rate Thread Display Modes 04-04-2011, 12:03 PM
Runtime Error 3001 Invalid Argument Ms Access
#1 kapaw Newly Registered User Join Date: Mar 2011 Posts: 30 Thanks: 5 Thanked 0 Times in 0
Runtime Error 3001 Arguments Are Of The Wrong Type Vb6
Posts Run Time Error 3001: Invalid Argument I've been experiencing this error and I don't know the reason why. I've checked my syntax and it looks good. Any suggestions? Private Sub CreateBOMTable() http://stackoverflow.com/questions/22008829/run-time-error-3001-invalid-argument-when-creating-a-table-in-access-vba Dim curDatabase As DAO.Database Dim tblBOM As DAO.TableDef Dim colMCN As DAO.Field Dim colPartType As DAO.Field Dim colDescription As DAO.Field Dim colLCP As DAO.Field Dim colMPN As DAO.Field Set curDatabase = CurrentDb Set tblBOM = curDatabase.CreateTableDef("BOM") Set colMCN = tblBOM.CreateField("MCN", DB_TEXT) colMCN.Attributes = dbAutoIncrField tblBOM.Fields.Append colMCN Set colPartType = tblBOM.CreateField("Part Type", DB_TEXT) colPartType.Attributes = dbAutoIncrField tblBOM.Fields.Append colPartType Set colDescription = tblBOM.CreateField("Description", DB_TEXT) colDescription.Attributes = http://www.access-programmers.co.uk/forums/showthread.php?t=207796 dbAutoIncrField tblBOM.Fields.Append colDescription Set colLCP = tblBOM.CreateField("Life Cycle Phase", DB_TEXT) colLCP.Attributes = dbAutoIncrField tblBOM.Fields.Append colLCP Set colMPN = tblBOM.CreateField("MPN Status", DB_TEXT) colMPN.Attributes = dbAutoIncrField tblBOM.Fields.Append colMPN curDatabase.TableDefs.Append tblBOM ' error shows here MsgBox "A table named BOM has been created" End Sub kapaw View Public Profile Find More Posts by kapaw 04-05-2011, 05:31 AM #2 JANR Newly Registered User Join Date: Jan 2009 Location: Norway Posts: 1,617 Thanks: 7 Thanked 161 Times in 154 Posts Re: Run Time Error 3001: Invalid Argument First of you cannot have more than 1 Autoincrement (Autonumber) in a table and it has to be Long Integer not text. Here is som code samples you can look at: http://allenbrowne.com/func-dao.html#CreateTableDAO As for your code it can be written something like this: Code: Public Sub MakeTableDemo() Dim curDatabase As DAO.Database Dim tblBOM As DAO.TableDef Dim fld As DAO.Field Set curDatabase = CurrentDb Set tblBOM = curDatabase.CreateTableDef("BOM") With tblBOM ' Only one AutoIncrement field pr table Set fld = .CreateField("MCN", dbLong) fld.Attributes = dbAutoIncrField + dbFixedField .Fields.Append fld .Fields.Append .CreateField("Part Type", dbText) .Fields.Append .CreateField("Description", dbText) .Fields.Append .CreateField("Life Cucle Phase", dbText) .Fields.Append .CreateField("MPN
Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for https://www.experts-exchange.com/questions/27245151/Runtime-Error-3001-Invalid-Argument-error.html Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > Runtime Error 3001 - Invalid Argument error Want to Advertise time error Here? Solved Runtime Error 3001 - Invalid Argument error Posted on 2011-08-08 Query Syntax MS Access MS Office 3 Verified Solutions 14 Comments 998 Views Last Modified: 2012-05-11 When trying to run the following piece of code I get a 'Runtime Error 3001 Invalid Argument'. This code has previously worked and I cannot time error 3001 find any changes to it. INTRAN is an ODBC database using a dataflex driver. Intran1 is a copy which keeps an offline backup (for faster reporting) I have tried changing the last line to: " WHERE ([INTRAN].[DATE] > #01/01/2011# and [INTRAN].[DATE] < #30/04/2011#);" And I still receive the same error strSQL = "INSERT INTO Intran1 ( [Key], RECORD_NUMBER, [INM#], WHSE, QTY, PRICE, NET, COST, DISCRATE, DISCOUNT, TAXRATE," & _ " TAXAMOUNT, [BATCH#], SEQUENCE, BATCH, PERIOD, TRAN, REF, [DATE], DETAIL, STOCK_CODE, [STOCKCAT#]," & _ " CATEGORY, QTY2, [NOTE], ORDER_NO, ORDER_SEQ_NO, FC_PRICE, FC_NET, FC_DISCOUNT, FC_TAXAMOUNT, FC_COST," & _ " [@SPARE1], [@SPARE2], [@SPARE3], [@SPARE4] )" & _ " SELECT DISTINCTROW Format([date],'yyyymmdd') & '-' & [record_number] AS [Key], INTRAN.RECORD_NUMBER," & _ " INTRAN.[INM#], INTRAN.WHSE, INTRAN.QTY, INTRAN.PRICE, INTRAN.NET, INTRAN.COST, INTRAN.DISCRATE," & _ " INTRAN.DISCOUNT, INTRAN.TAXRATE, INTRAN.TAXAMOUNT, INTRAN.[BATCH#], INTRAN.SEQUENCE, INTRAN.BATCH," & _ " INTRAN.PERIOD, INTRAN.TRAN, INTRAN.REF, INTRAN.DATE, INTRAN.DETAIL, INTRAN.STOCK_CODE," & _ " INTRAN.[STOCKCAT#], INTRAN.CATEGORY, INTRAN.QTY2, I