Selecting Memo Field from ComboBox

kappa

Registered User.
Local time
Today, 19:05
Joined
May 11, 2005
Messages
21
Hi All,
I am not sure if this is an easy one or not..
I have a field in a table named Stock_Alias. This field was originally set as a Number field. I have a combo box on a form, which contains the Stock_Alias numbers. When a number is selected, the remaining fields are shown in text boxes.
I have had to change the Stock_Alias field to a memo, to incorporate Numbers & Characters.
I cannot seem to hit on the right code to get the same results as i did when the field was a number field..


This was the code I was using to select the field as a number...

Private Sub Cmbo_Stock_Alias_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Stock_Alias] = " & Str(Me![Cmbo_Stock_Alias])
Me.Bookmark = rs.Bookmark

End Sub
 
I have had to change the Stock_Alias field to a memo, to incorporate Numbers & Characters.

You only need to use a Memo field if you are storing more than 255 characters in the field. Avoid Memos if you can because they are a special type of field and more likely to cause corruption than a normal one.

Mixed numbers and text just become text so you can use a normal text field.
To search for text you have to wrap in quotes

rs.FindFirst "[Stock_Alias] = '" & Str(Me![Cmbo_Stock_Alias]) & "'"

That last bit is a single quote between double quotes:)


HTH

Peter
 
Thanks for your help,
I have just changed The Stock_Alias field to "text" and included the inverted commas as you suggested. All I get is a "Type mismatch" error on that line of code.
 
Sorry, I meant, a single quote between double quotes..
 
I just realised what was happening.. I no longer need the str command as I am now reading text..
Thanks again for your help Peter..
 

Users who are viewing this thread

Back
Top Bottom