help with Control source

  • Thread starter Thread starter francvs
  • Start date Start date
F

francvs

Hi everybody,

I don't know if "control source problem" is the right way to call it...
anyway:
I am trying to build a form for entering a code divided in 2 parts
(like "xxx-xxxxx", where x is a digit). The 3 digits on the left
correspond to a category name. As a consequence, I want to be able to
set this first part of my code with a combo box presenting the n
possible categories. This is accomplished with the following function:

'Private Sub ComboCategoria_AfterUpdate()
Dim dbs As Database
Dim rsSQL As DAO.Recordset
Dim thisSQL As String
Set dbs = CurrentDb
' Open a snapshot-type recordset picking up last chosen combo value
thisSQL = "SELECT Codifica FROM val_Categoria WHERE [Valore] = '" &
Me.ComboCategoria.Value & "'"
Set rsSQL = dbs.OpenRecordset(thisSQL, dbOpenSnapshot)
Me.CodeLeftPart.Value = rsSQL("Codifica")
'End Sub

where val_Categoria is the table with category names and three-digit
values.

Now, the trouble is that i can't synchronize the "CodeLeftPart" with
the category values of fields already present in the table when i surf
the recordset with navigation buttons "next" "prev", etc. I can't
figure out which event I should trigger for a function like the one
above. Any hint? or should i take a different path?

Thanks in advance.
fr
 
Back
Top