When I create an append Query in ms-access 2013 with parameters and any of those parameters' type is set to LongText
the query fails with error code 3001 Invalid Argument
. Changing the type to ShortText
however results in a working query. Both version are runnable by double clicking the query in access itself, but the first one fails when running it via following code:
Dim db As DAO.Database
Set db = CurrentDb
Dim qdf As QueryDef
Set qdf = db.QueryDefs("NeuerFachlicherInhalt")
qdf!Inhalt = inhalte("DefaultInhalt")
qdf!Formular = inhalte("Formular")
qdf.Execute
The table I insert the parameter to has a field type of LongText
and therefore I would expect this to work - what is the root cause of the issue here? And how can I pass in a long text if I am unable to specify a LongText
as parameter?
I think it might be connected to the length limitations of Strings in access. What exactly are those limitations? Google redirects you to concatenation and max length of string in VBA, access regarding the question for string lengths, but i can not find a definite answer to the length question(s):
- how long can the text for
ShortText
be? - how long can the text for
LongText
be? - how long can the text for a vba
String
be?
My queries in the two cases look like
PARAMETERS Inhalt LongText, Formular Short;
INSERT INTO FachlicherInhalt ( Inhalt, Formular )
SELECT [Inhalt] AS Expr1, [Formular] AS Expr2;
PARAMETERS Inhalt Text ( 255 ), Formular Short;
INSERT INTO FachlicherInhalt ( Inhalt, Formular )
SELECT [Inhalt] AS Expr1, [Formular] AS Expr2;
inhalte
is a Recordset object then try explicitly specifying the.Value
property, e.g.,inhalte("DefaultInhalt").Value
and see if that makes any difference. – Eboat