[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 461
  • Last Modified:

Open Form using search criteria

I'm trying to open a record based off the search criteria in a list box.  The search form is MyForm and the record source is querySPInfo the list box is bound to the field ServicePartner.  In the list box the rowsource is SELECT tbldServicePartners.ServicePartner FROM tbldServicePartners ORDER BY [ServicePartner];.  When the user double clicks on a value in the list box, I want it to open the editing form with the details from that selected record.  The double click command is


Private Sub ServicePartner_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmSPEdit", , , "ServiceParter=" & ServicePartner
End Sub

However, i am getting a runtime error 3075.

Can you help me fix this?
0
LizAMuscato
Asked:
LizAMuscato
  • 2
1 Solution
 
jjafferrCommented:
try this:

assuming ServicePartner is a number:

Private Sub ServicePartner_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmSPEdit", , , "[ServiceParter]=" & ServicePartner
End Sub

but if ServicePartner is a text, then

Private Sub ServicePartner_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmSPEdit", , , "[ServiceParter]='" & ServicePartner & "'"
End Sub
0
 
LizAMuscatoAuthor Commented:
Now it's popping up a paramter box for ServicePartner.
0
 
nico5038Commented:
Check the name of that field as Access can't find it in the query for your form...

Nic;o)
0
 
LizAMuscatoAuthor Commented:
Thanks. !
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now