Hi,
I have a complex action query that I need to run several times, varying a parameter in the where clause each time. The way I've always done this in the past is to just copy the whole sql string into my code, edit via code as necessary, and run it via db.execute. This works fine.
However, it seems like it would be easier to maintain if I could keep this query as a static querydef object, and just use VB to edit the parameter. It seems like I should be able to do this using the parameter object, but I'm very confused by it and it doesn't seem to work.
Here's what I'm trying to do:
currentdb.querydefs("SMT_ABC_refresh").parameters("VS")="HVLT"
currentdb.execute "SMT_ABC_Refresh",dbfailonerror
When I run this, I get an error message "too few parameters", so obviously my "hvlt" parameter is not getting picked up by the query.
Is my syntax just wrong? Or is this just not possible?
Thanks for any suggestions.
I have a complex action query that I need to run several times, varying a parameter in the where clause each time. The way I've always done this in the past is to just copy the whole sql string into my code, edit via code as necessary, and run it via db.execute. This works fine.
However, it seems like it would be easier to maintain if I could keep this query as a static querydef object, and just use VB to edit the parameter. It seems like I should be able to do this using the parameter object, but I'm very confused by it and it doesn't seem to work.
Here's what I'm trying to do:
currentdb.querydefs("SMT_ABC_refresh").parameters("VS")="HVLT"
currentdb.execute "SMT_ABC_Refresh",dbfailonerror
When I run this, I get an error message "too few parameters", so obviously my "hvlt" parameter is not getting picked up by the query.
Is my syntax just wrong? Or is this just not possible?
Thanks for any suggestions.