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!

Insert Statement Not Working With SQL Server Back End 1

Status
Not open for further replies.

DomDom3

Programmer
Jan 11, 2006
59
GB
Hi,

I've recently upsized an Access database to SQL Server and am working through all the bugs that have now ppeared as a reesult.

The code belwo worked fine in an Access only DB but now the form reference at the end of the statement is n't accepted.

DoCmd.RunSQL "INSERT INTO dbo.[tblpartnercosts] ([unique ID]) " _
& "select [tblPartnerCostsPrevious].[unique ID] " _
& "from [tblPartnerCostsPrevious] " _
& "Where [tblPartnerCostsPrevious].[unique ID] = [Forms].[frminstallationOutlook].[Unique ID]"

Do I need to do something different now with SQL Server if I want to use the value of a form's control as part of a statement?

Thanks
 
How about:

[tt]DoCmd.RunSQL "INSERT INTO dbo.[tblpartnercosts] ([unique ID]) " _
& "select [tblPartnerCostsPrevious].[unique ID] " _
& "from [tblPartnerCostsPrevious] " _
& "Where [tblPartnerCostsPrevious].[unique ID] = " & [Forms].[frminstallationOutlook].[Unique ID][/tt]
 
Thanks for looking, but no I get a "Run-Time 438 Object Not Supported..." error.

The error I get with the code I mention first off is...

"Run-time error 107 The Column Prefix 'forms.frminstallationoutlook' does not match with a tablename...

I thought that "forms!" before the form name would indicate that it was not a table I was referencing.

 
Yes, I missed the stop, it should be a bang:
[Forms][red]![/red][frminstallationOutlook].[Unique ID]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top