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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling multiple fields from SQL

Status
Not open for further replies.

bombplayer

Programmer
Jul 3, 2001
47
US
I am trying to pull up multiple data fields from a SQL view with the use of a combo box. This is the code I am using:

Private Sub cboSelect_computer_AfterUpdate()
Dim str2 As String

Me.Controls(cboSelect_Computer.Column(0)).SetFocus
DoCmd.FindRecord cboSelect_Computer

str2 = Me.Controls(cboSelect_Computer.Column(0))

End Sub

When I try to run it real time, I get an error that it cannot find the ID from the lookup with several blank characters after the ID i.e. "01234 " cannot be found. 01234 is in the database.

I think I am way off on this. Any help would be appreciated.
 
bombplayer
Not to far off. You just need to clean it up a bit
try
Code:
str2 = Trim(Me.Controls(cboSelect_Computer.Column(0)))

Scoty ::)
"Learn from others' mistakes. You could not live long enough to make them all yourself."
-- Hyman George Rickover (1900-86),
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top