opening a form at a particular record

  • Thread starter DowningDevelopments
  • Start date
D

DowningDevelopments

Hello all,

I am using the Docmd.openform to open a form based on a selection that the
user makes from a list on the current form. this is the code im currently
using.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Gurantors"

stLinkCriteria = "[Postcode]=" & "'" & Me![POBOX1] & "'" & _
" And " & "[Postcode2]=" & "'" & Me![POBOX2] & "'" _
" And " & "[GuarantorDate]=" & "'" & Me![Gyear] & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit

this causes an error which manifests itself as a message box telling me that
the form open was cancelled!
when i change the stlinkcriteria to just:

stLinkCriteria = "[Postcode]=" & "'" & Me![POBOX1] & "'" & _
" And " & "[Postcode2]=" & "'" & Me![POBOX2] & "'"

it works just fine but i need all three to make sure i get the right record.
whats making it go wrong when i add another argument?? Do i need to add
brakets??

Much thanks for looking at this problem,

Amit
 

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