Compile error with different installs of Access

G

Guest

Hi,

Using Access installed on two different machines I get a compile error on
one machine and not on the other.

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 & ";"

If I change the statement to:

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] & ";"

It compiles fine on both machines.

Since I need to develop on the machine where the first statement compiles
and runs correctly and it still needs to compile and run on the other
machine, I need to know what to change to make the environments compatible.
 
G

Guest

The problem is at the end. The relevent section is 'Me.contactid' in one and
'Me![contactid]' in the other

Also 'Me.contactid' could be replaced with 'contactid' on the working machine.

Earl

Douglas J. Steele said:
I don't see any difference between the two statements you've posted!

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


EarlAtSSCS said:
Hi,

Using Access installed on two different machines I get a compile error on
one machine and not on the other.

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 & ";"

If I change the statement to:

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] & ";"

It compiles fine on both machines.

Since I need to develop on the machine where the first statement compiles
and runs correctly and it still needs to compile and run on the other
machine, I need to know what to change to make the environments
compatible.
 
G

Granny Spitz via AccessMonster.com

EarlAtSSCS said:
I need to know what to change to make the environments compatible.

Change the name of the contactid text box to something like txtcontactid and
use this new name in your code.
 
G

Guest

We have discovered the problem and fixed it.

There were remote table additionss that were not updated on the machine
where the compile failed. Because of this the second version of the
statement, with the brackets, compiled as the contents were not checked by
the compiler.

Thanks for the effort.
 

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