SQL String Text

CarlM1975

Registered User.
Local time
Today, 11:06
Joined
Oct 29, 2008
Messages
24
I have the following SQL but I can not get the me.assetsubasset into text format and therefore the statement does not run

Can anybody help?

Here is the SQL:

dbs.Execute ("SELECT [Reactive Scorecard Data].[Asset & Sub Asset], [Category Lookup Table].Category, [Reactive Scorecard Data].[Day Requested], [Reactive Scorecard Data].Asset, [Reactive Scorecard Data].Code, [Reactive Scorecard Data].JobCode, [Reactive Scorecard Data].Contractor, [Reactive Scorecard Data].Priority, [Reactive Scorecard Data].[True Requested At] INTO tblcarl FROM [Reactive Scorecard Data] LEFT JOIN [Category Lookup Table] ON [Reactive Scorecard Data].[Asset & Sub Asset] = [Category Lookup Table].Asset WHERE ((([Reactive Scorecard Data].[Asset & Sub Asset])=" & Me.assetsubasset)

I'm sure its all quote related but I cant seem to get them in the correct place.

Thanks

Carl.
 
Remove the extra bracket marked in red below.

Code:
 WHERE [COLOR=red]([/COLOR](([Reactive Scorecard Data].[Asset & Sub Asset])=" & Me.assetsubasset)

and what is the data type of assetsubasset in the table?

Cheers
 
Try the following. it should work fine if assetsubasset is number data type.

Code:
dbs.Execute ("SELECT [Reactive Scorecard Data].[Asset & Sub Asset], [Category Lookup Table].Category, [Reactive Scorecard Data].[Day Requested], [Reactive Scorecard Data].Asset, [Reactive Scorecard Data].Code, [Reactive Scorecard Data].JobCode, [Reactive Scorecard Data].Contractor, [Reactive Scorecard Data].Priority, [Reactive Scorecard Data].[True Requested At] INTO tblcarl FROM [Reactive Scorecard Data] LEFT JOIN [Category Lookup Table] ON [Reactive Scorecard Data].[Asset & Sub Asset] = [Category Lookup Table].Asset WHERE (([Reactive Scorecard Data].[Asset & Sub Asset])=" & Me.assetsubasset &")")

Cheers
 
Just remove all of the parens (not needed):

WHERE [Reactive Scorecard Data].[Asset & Sub Asset]=" & Me.assetsubasset
 

Users who are viewing this thread

Back
Top Bottom