OLE Object update in form from Combo Box Selection

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

Hi.

I'm using the following code to try and display a graphic
based on the "team" selected from a combo box in a form.
As query it works fine but when I use VB it does not.
What am I missing? Thanks.

Table = Games
Field = HTeamID

Table = Teams
Field = TeamID

Private Sub HTLogo_BeforeUpdate(Cancel As Integer)
SQLText = "SELECT [Teams.Logo] FROM [Teams]" & _
"INNER JOIN Game ON [Game].[HTeamID]=[Teams].[TeamID]"
End Sub
 
Hi,


Teams.Logo or [Teams].[logo] rather than [Teams.logo]


Whatever is inside the [ ] is "out of syntax", its main use is to get
illegal names accepted (name with a space, reserved words, etc). In your
case, you can remove them, but in any cases, you want the SYNTAX tableName
dot fieldName. With your initial typing, the database engine was looking
for a potentially illegal field name textually equal to: temps.logo
Since not such field name exists, an error occurred.

Hoping it may help,
Vanderghast, Access MVP
 
No joy and no error message either. Thanks anyway. I'll
get it eventually.......
-----Original Message-----
Hi,


Teams.Logo or [Teams].[logo] rather than [Teams.logo]


Whatever is inside the [ ] is "out of syntax", its main use is to get
illegal names accepted (name with a space, reserved words, etc). In your
case, you can remove them, but in any cases, you want the SYNTAX tableName
dot fieldName. With your initial typing, the database engine was looking
for a potentially illegal field name textually equal to: temps.logo
Since not such field name exists, an error occurred.

Hoping it may help,
Vanderghast, Access MVP


Matt said:
Hi.

I'm using the following code to try and display a graphic
based on the "team" selected from a combo box in a form.
As query it works fine but when I use VB it does not.
What am I missing? Thanks.

Table = Games
Field = HTeamID

Table = Teams
Field = TeamID

Private Sub HTLogo_BeforeUpdate(Cancel As Integer)
SQLText = "SELECT [Teams.Logo] FROM [Teams]" & _
"INNER JOIN Game ON [Game].[HTeamID]=[Teams]. [TeamID]"
End Sub
 
Hi,


It is also preferable to have a space before and after each keyword.
You do not have one before INNER. With that space, you do not need any [ ]
anywhere.


What do you do, after, with the SQL string you have build? You are in a
before update event... something you take for given may have not occurred
yet.


Vanderghast, Access MVP


Matt said:
No joy and no error message either. Thanks anyway. I'll
get it eventually.......
-----Original Message-----
Hi,


Teams.Logo or [Teams].[logo] rather than [Teams.logo]


Whatever is inside the [ ] is "out of syntax", its main use is to get
illegal names accepted (name with a space, reserved words, etc). In your
case, you can remove them, but in any cases, you want the SYNTAX tableName
dot fieldName. With your initial typing, the database engine was looking
for a potentially illegal field name textually equal to: temps.logo
Since not such field name exists, an error occurred.

Hoping it may help,
Vanderghast, Access MVP


Matt said:
Hi.

I'm using the following code to try and display a graphic
based on the "team" selected from a combo box in a form.
As query it works fine but when I use VB it does not.
What am I missing? Thanks.

Table = Games
Field = HTeamID

Table = Teams
Field = TeamID

Private Sub HTLogo_BeforeUpdate(Cancel As Integer)
SQLText = "SELECT [Teams.Logo] FROM [Teams]" & _
"INNER JOIN Game ON [Game].[HTeamID]=[Teams]. [TeamID]"
End Sub
 
Back
Top