michaelgiesbrecht
Registered User.
- Local time
- Yesterday, 21:54
- Joined
- Jun 29, 2012
- Messages
- 12
Hi everyone;
I'm fairly new to access vba programming; and I'm having some trouble getting my sql queries to work in VBA.
What I have is a form where the user can enter (or scan) a job number from a sheet. When they exit that field I have a vba procedure that takes the job number that they enetered and performs some string functions on it to make it usable for my query (the tables that I am interfacing with are part of our ERP system; so I can't change them......)
What I want to do is take that job number; split it into the two fields that I need (the job number uses this syntax : ordernumber"-"linenumber)
My code takes the job number and splits it into two variables; ordernum and linenum.
Now what I need to do is build a query that will search the ERB table and pull out the record that pertains to that order number and line number (it will always be a single record as the combination of order number and line number produces a unique record)
so what I want is this:
select (some stuff) from (erp tables) where table.ordernumber = ordernum and table.linnumber = linenum
I just can't seem to get the syntax to work, I always get an object variable not set error.
I then want to turn that into a record set so that I can pull information from that record into my form and eventually into my report.
I'm fairly new to access vba programming; and I'm having some trouble getting my sql queries to work in VBA.
What I have is a form where the user can enter (or scan) a job number from a sheet. When they exit that field I have a vba procedure that takes the job number that they enetered and performs some string functions on it to make it usable for my query (the tables that I am interfacing with are part of our ERP system; so I can't change them......)
What I want to do is take that job number; split it into the two fields that I need (the job number uses this syntax : ordernumber"-"linenumber)
My code takes the job number and splits it into two variables; ordernum and linenum.
Now what I need to do is build a query that will search the ERB table and pull out the record that pertains to that order number and line number (it will always be a single record as the combination of order number and line number produces a unique record)
so what I want is this:
select (some stuff) from (erp tables) where table.ordernumber = ordernum and table.linnumber = linenum
I just can't seem to get the syntax to work, I always get an object variable not set error.
I then want to turn that into a record set so that I can pull information from that record into my form and eventually into my report.