G
GenesisVF
Hello all,
I would like to use some complex SQL statements inside my access
project which uses VB and I am trying to find out a way of adding SQL
code into VBA in such way that VBA understands the syntax.
My aim is to work SQL commands in Access and be able to set the SQL
variables from a form.
Currently I know how to "wrap" SQL statements in VBA strings and then
concatenate the strings and send them to be processed.
For example at the moment if I have an SQL statement that looks like
this:
select * from employee_table where name = 'GEORGE' and employee_number
= '1234'
In VBA I would translate the above command as:
SQL_string_1 = "select * from employee_table where name = ' "
name = (Get_variable_from_form)
SQL_String_2 = " ' and employee_number = ' "
employee_number = (Get_the_other_variable_from_the_form)
SQL_String_3 = " ' "
and then, I would run the equivalent VB command to process it:
process: SQL_String_1 & cell_id & SQL_String_2 & bsc_id &
SQL_String_3
In essence, I have to HARD CODE the SQL commands into VBA strings and
this is such a pain and bad programming!
Do you know any other way ?
Your help would be most grateful.
Thanks
Genxx
I would like to use some complex SQL statements inside my access
project which uses VB and I am trying to find out a way of adding SQL
code into VBA in such way that VBA understands the syntax.
My aim is to work SQL commands in Access and be able to set the SQL
variables from a form.
Currently I know how to "wrap" SQL statements in VBA strings and then
concatenate the strings and send them to be processed.
For example at the moment if I have an SQL statement that looks like
this:
select * from employee_table where name = 'GEORGE' and employee_number
= '1234'
In VBA I would translate the above command as:
SQL_string_1 = "select * from employee_table where name = ' "
name = (Get_variable_from_form)
SQL_String_2 = " ' and employee_number = ' "
employee_number = (Get_the_other_variable_from_the_form)
SQL_String_3 = " ' "
and then, I would run the equivalent VB command to process it:
process: SQL_String_1 & cell_id & SQL_String_2 & bsc_id &
SQL_String_3
In essence, I have to HARD CODE the SQL commands into VBA strings and
this is such a pain and bad programming!
Do you know any other way ?
Your help would be most grateful.
Thanks
Genxx