I am not sure as to the best way to describe this problem to make it clear to you. I have recently changed a field on a form which previously was a standard field but for the sake of user friendliness and data quality control, has now become a drop down field linked to a table and therefore provides a drop down list when the user is to enter data (instead of typing).
The issue encounterd is as follows:
This field, upon entering a value (in this case the name of a team (below listed as txtTeam) triggers an after update event so that using ADO code takes the team name, references it to an underlying team table and then copies corresponding values into the fields: "txtCity", "txtCountry", "txtCAP", "txtOfficialTeamName", ect (see below)
Unfortunately, once i changed the team field to a list field linked to the table, the If statement which I flagged below with (* HERE IS MY PROBLEM - ...) is no longer valid and unfortunately the ADO copy/paste code no longer works.
**Note: When going into the VBA editor and hovering my mouse over "Team_name" and "txtTEam" the following result appears showing me that the issue is directly linked to the fact that I have converted this field to a drop down field.
Team_name = Operational Excellence (the actual name of the team selected)
txtTEam = '71' (the ID number of the team "Operational Excellence" on the underlying table
I hope someone can help me with this because this form is really useful for me an without this code, it loses alot.
Thanks,
A
Dim rstTEAM As New ADODB.Recordset
rstTEAM.Open "tblTeams", CurrentProject.Connection, _
adOpenForwardOnly
Do Until rstTEAM.EOF
If rstTEAM!Team_name = txtTEam Then (*** HERE IS MY PROBLEM- this statement is no longer TRUE)
txtCity = rstTEAM!City
txtCountry = rstTEAM!Country
txtCAP = rstTEAM!CAP
txtOfficialTeamName = rstTEAM!Official_Team_Name
txtStreet = rstTEAM!Street
txtDivision = rstTEAM!Division
txtNumerotel.SetFocus
blnAggiunto = True
Exit Sub
Else
rstTEAM.MoveNext
End If
Loop
rstTEAM.Close
Set rstTEAM = Nothing