After Update Help!

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
 
D

Douglas J. Steele

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)
 
B

Bob

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
 
D

Douglas J. Steele

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)
 
B

Bob

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
 
D

Douglas J. Steele

Sorry, I don't understand what you mean by "I could not get it to select the
forms."
 
B

Bob

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
 
D

Douglas J. Steele

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.
 
B

Bob

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
 
B

Bob

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top