After Update Help!

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

--
I have a Query linked to my form, I have a combobox drop down list with this
row source(SELECT qryAHOPF.Name, qryAHOPF.HorseID FROM qryAHOPF; ) that
shows my horses names, what would i need in After Update so it selects the
horse in the dropdown list

SELECT QryOwnerHorsePercent.OwnerID, qryHorseFinished.Name,
QryOwnerHorsePercent.HorseID, QryOwnerHorsePercent.OwnerPercent,
tblOwnerInfo.OwnerID, tblOwnerInfo.OwnerTitle, tblOwnerInfo.OwnerFirstName,
tblOwnerInfo.OwnerLastName, tblOwnerInfo.OwnerAddress, tblOwnerInfo.Phone1,
tblOwnerInfo.Phone2, tblOwnerInfo.Email, tblOwnerInfo.CellPhone
FROM qryHorseFinished INNER JOIN (QryOwnerHorsePercent INNER JOIN
tblOwnerInfo ON QryOwnerHorsePercent.OwnerID = tblOwnerInfo.OwnerID) ON
qryHorseFinished.HorseID = QryOwnerHorsePercent.HorseID;


..........Thanks Bob Vance
 
Are you saying you want to limit what's returned to only records related to
the horse that's selected in the combo box?

Add

WHERE qryHorseFinished.HorseID = Forms!FormName!ComboBoxName

(replace FormName and ComboBoxName with the appropriate)
 
I placed this in After Update "WHERE qryHorseFinished.HorseID =
Forms!frmAHOPF!Combo22"
, then when i selected a horse Nothing happened, yes would just like it to
select the horse i click on in the dropdown list...Thanks Bob
 
If the query is the recordsource for the form, you can use a Filter.

Private Sub Combo22_AfterUpdate()

Me.Filter = "qryHorseFinished.HorseID = " & _
Forms!frmAHOPF!Combo22
Me.FilterOn = True

End Sub

This assumes HorseID is numeric. If it's text, use

Me.Filter = "qryHorseFinished.HorseID = '" & _
Forms!frmAHOPF!Combo22 & "'"

or

Me.Filter = "qryHorseFinished.HorseID = " & _
Chr$(34) & Forms!frmAHOPF!Combo22 & Chr$(34)
 
Douglas, I could not get it to select the forms. I have a Query
"qryHorseFinished" (HorseID, HorseName) then I have "qryAHOPF" (OwnerName,
Address, Percentage)that links the horse with his owner and percent and
address. the form is based on the qryAHOPF..............Thanks for your
help.........Bob
 
Sorry, I don't understand what you mean by "I could not get it to select the
forms."
 
After entering your codes, When I selected a horse in my drop down list, it
would no show that horses record on forms, the best I got was "Enter
parameters value and the horses Name....Thanx for your help...Bob
 
Are you saying that a popup box came, asking you for a value? That implies
you either mistyped the name of the field in filter, or the field is text
and you forgot the quotes.
 
The closest I can get to opening a form is:
Private Sub Combo30_AfterUpdate()
Me.Filter = "qryAHOPF.Name = " & _
Forms!frmAHOPF!Combo30
Me.FilterOn = True
and I am getting the error box [Syntax Error, Missing operator, in Query
Expression QryAHOPF.name =Mr Bond]
Thanks Bob

End Sub
 
GOT IT Thanks
Private Sub Combo24_AfterUpdate()
Me.Filter = "qryHorseFinished.HorseID = " & _
Forms!frmHorseFinished!Combo24
Me.FilterOn = True

End Sub
Brilliant Thanks

Bob said:
The closest I can get to opening a form is:
Private Sub Combo30_AfterUpdate()
Me.Filter = "qryAHOPF.Name = " & _
Forms!frmAHOPF!Combo30
Me.FilterOn = True
and I am getting the error box [Syntax Error, Missing operator, in Query
Expression QryAHOPF.name =Mr Bond]
Thanks Bob

End Sub
Douglas J. Steele said:
Are you saying that a popup box came, asking you for a value? That
implies you either mistyped the name of the field in filter, or the field
is text and you forgot the quotes.
 
Back
Top