Compiler Environment problem

G

Guest

Hi,
I have an evironment problem.

One computer will compile and run correctly code, but another will generate
a compile error.
Both machines are running Office Access 2003.

A sample of the problem is:
query = "SELECT contact.Phone, contact.CDBSiteNumber, t_contacts.contact_id
AS CustomerNumber, t_contacts.company_name " & _
"FROM contact INNER JOIN t_contacts ON contact.Cust_ =
t_contacts.contact_id " & _
"WHERE contact.[contact id] = " & Me.ContactID & ";"

Both machines compile and run correctly if the code is changed to this:
query = "SELECT contact.Phone, contact.CDBSiteNumber, t_contacts.contact_id
AS CustomerNumber, t_contacts.company_name " & _
"FROM contact INNER JOIN t_contacts ON contact.Cust_ =
t_contacts.contact_id " & _
"WHERE contact.[contact id] = " & Me![ContactID] & ";"

I need both machines to either accept the first version or generate the
compile error.
Earl
 
R

ruralguy via AccessMonster.com

I would think they both would work. Have you checked to see if you have any
bogus MISSING references on either computer? <ALT> F11 then Tools>References.
..
Hi,
I have an evironment problem.

One computer will compile and run correctly code, but another will generate
a compile error.
Both machines are running Office Access 2003.

A sample of the problem is:
query = "SELECT contact.Phone, contact.CDBSiteNumber, t_contacts.contact_id
AS CustomerNumber, t_contacts.company_name " & _
"FROM contact INNER JOIN t_contacts ON contact.Cust_ =
t_contacts.contact_id " & _
"WHERE contact.[contact id] = " & Me.ContactID & ";"

Both machines compile and run correctly if the code is changed to this:
query = "SELECT contact.Phone, contact.CDBSiteNumber, t_contacts.contact_id
AS CustomerNumber, t_contacts.company_name " & _
"FROM contact INNER JOIN t_contacts ON contact.Cust_ =
t_contacts.contact_id " & _
"WHERE contact.[contact id] = " & Me![ContactID] & ";"

I need both machines to either accept the first version or generate the
compile error.
Earl
 
G

Guest

If you are creating a string with the name query, that may be a problem.
Using reserved words in Access is always a bad idea. Try changing it to
somethinkg liek strSQL. That is a variable name you will see a lot.

ruralguy via AccessMonster.com said:
I would think they both would work. Have you checked to see if you have any
bogus MISSING references on either computer? <ALT> F11 then Tools>References.
..
Hi,
I have an evironment problem.

One computer will compile and run correctly code, but another will generate
a compile error.
Both machines are running Office Access 2003.

A sample of the problem is:
query = "SELECT contact.Phone, contact.CDBSiteNumber, t_contacts.contact_id
AS CustomerNumber, t_contacts.company_name " & _
"FROM contact INNER JOIN t_contacts ON contact.Cust_ =
t_contacts.contact_id " & _
"WHERE contact.[contact id] = " & Me.ContactID & ";"

Both machines compile and run correctly if the code is changed to this:
query = "SELECT contact.Phone, contact.CDBSiteNumber, t_contacts.contact_id
AS CustomerNumber, t_contacts.company_name " & _
"FROM contact INNER JOIN t_contacts ON contact.Cust_ =
t_contacts.contact_id " & _
"WHERE contact.[contact id] = " & Me![ContactID] & ";"

I need both machines to either accept the first version or generate the
compile error.
Earl
 

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