is the form "frmPolicyData" open when you are running the query? it should be.
Main Topics
Browse All TopicsExperts - I am having trouble getting the data to feed to the below query from a Form. If I enter the criteria directly it works fine.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Also make sure the MsgBox (Forms]![frmPolicyData]![t
Function fnPH_NUM() As Variant
On Error GoTo 10
MsgBox (Forms]![frmPolicyData]![t
If Nz([Forms]![frmPolicyData]
fnPH_NUM() ="<All>"
Else
fnPH_NUM() =Forms]![frmPolicyData]![t
End IF
Exit Function
10:
fnPH_NUM() ="<All>"
End Function
re:> I need the SQL to take the input from a cotnrol on a form
Do you mean from: Forms]![frmPolicyData]![tx
I
Re:> use in a DELETE query
If you want to delete, use
CurrentDB.Execute "Delete * From TBL_MAIN Where PH_NUM = fnPH_NUM();"
With:
Function fnPH_NUM() As Long
On Error GoTo 10
If Nz([Forms]![frmPolicyData]
fnPH_NUM() =91919191
Else
fnPH_NUM() =Forms]![frmPolicyData]![t
End IF
Exit Function
10:
fnPH_NUM() 91919191
End Function
Assuming fnPH_NUM is long and never is equal to 91919191
Business Accounts
Answer for Membership
by: TextReportPosted on 2009-04-07 at 08:11:32ID: 24088153
Can you please check the exact spelling of the form name and that it is open at the time you are running the query.
Can you please check the exact name of the control on the form.
Other than that it looks correct, does it prompt you for a value? Is so then either the form is not open in FORM or DATASHEET view or the control name is wrong.
Cheers, Andrew