Parameters to Query String

BlueIshDan

☠
Local time
Today, 10:51
Joined
May 15, 2014
Messages
1,122
Does anyone know if access VBA implements parameters passed to query strings in all following parameters?

I've been working in ASP.NET/Razor C# and this would be an example of how it would be done:

Razor C#
Code:
db.Query("INSERT INTO threads (name, date_of_creation, user_id, area_id, user_group_id)" +
           " VALUES(@0, @1, @2, @3, @4)",
           Request["txtThreadTitle"],
           DateTime.Now,
           Session["user_id"],
           area_id,
           0
       );

Anyone know any kind of similar functionality in VBA ?
 
You can use the Querydefs collection of the CurrentDb object. It allows you to pass parameters.
 
Something along the lines of this:

Code:
With CurrentDb.CreateQueryDef("", "Insert Into MyTable (MyNum,MyText,MyDate,MyBool) " & _
                                  "Values(p0,p1,p2,p3)")
    .Parameters(0) = Me.tNum
    .Parameters(1) = Me.tText
    .Parameters(2) = Me.tDate
    .Parameters(3) = Me.tBool
    .Execute
End With
Jan R
 
There it is perfect! You're the Man! Or if female... You're tha Lady!
 
@BluIshDan

You are welcome, I'll take "I'm the man" :D

Jan Roger
 
Right on Jan Roger!
You D'Man!
YouDaManJesus.jpg
 

Users who are viewing this thread

Back
Top Bottom