Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

After Upsize to SQL Server SQL code from VBA no longer works

Status
Not open for further replies.

DomDom3

Programmer
Jan 11, 2006
59
GB
Hi there,

The following code worked perfectly well with Access;

Forms![frmdeleteProject]![sfrmAddRemoveRecord].Form![CustomerDelete] = DLookup("[Customer name]", "[tblOSPWithAllAddedFields]", "Forms![frmdeleteProject]![sfrmAddRemoveRecord]!Form![UniqueIDdelete]=[tblOSPWithAllAddedFields]![Unique ID]")

after upsizing, I get a syntax error pointing to

Forms![frmdeleteProject]![sfrmAddRemoveRecord]!Form![UniqueIDdelete]=[tblOSPWithAllAddedFields]![Unique ID]"

Can anyone tell why?

Thanks
 
Try:

DLookup("[Customer name]", "[tblOSPWithAllAddedFields]", "[tblOSPWithAllAddedFields]![Unique ID]=" & Forms![frmdeleteProject]![sfrmAddRemoveRecord].Form![UniqueIDdelete]

Assuming that the ID field is numeric.
 
Thanks for your suggestion, it didn't quite work but gave me the inspiration to try

Forms![frmdeleteProject]![sfrmAddRemoveRecord].Form![CustomerDelete] = DLookup("[Customer name]", "[tblOSPWithAllAddedFields]", Forms![frmdeleteProject]![sfrmAddRemoveRecord].Form![UniqueIDDelete] & " =[tblOSPWithAllAddedFields].[Unique ID]")

and it worked - thanks for yor help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top