QueryDefs ?

M

Mark

Hello all,

I’m am using a queryDef to pass some variables to a query. I am passing
numbers from a combo boxes that have leading zeros. However, when it passes
it drops the leading zeros. How can I stop this?

Setup:

CbZone = 01
CbRow = “04â€


Dim qdfTemp as DAO.QueryDef

vSQL = “ Select * from tbLocation where zone = “ & cbZone & “ and row = “ &
cbRow & “.

set qdfTemp – currentDb.QueryDefs(“qrTempâ€)
qdfTemp.SQL = vSQL
Docmd.OpenQuery “qrTempâ€

Once ran I look at the query and the leading zeros are gone.
 
T

Tom Ellison

Dear Mark:

Putting a breakpoint in the code would allow you to see and to post the SQL
being used.

You do not show how CbZone and CbRow are dimensioned. If they are numeric,
then they will not save the leading zeros. Even if CbZone is a string (as
it must be to keep the leading zero) it would never receive the leading
zero, since the 01 is not in quotes.

Tom Ellison
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top