Linking from One Form to Another - Getting Parameter Entry Box

J

jshrop

Hello Everyone,
Been searching through here, and can't find a solution to my problem,
so thought I would give it a go with a post.

I have a form that opens data from table a. There is a linked field in
table a to the same field name in table b. I am trying to create a
function to jump from the form displaying the table a fields to the
table b fields based on the link criteria that those two fields are
identical. Here is my code:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "fInquiries"

stLinkCriteria = "[Inquiry_Reference_Number] =" &
Me![Inquiry_Reference_Number]
'MsgBox (stLinkCriteria)
DoCmd.Close

DoCmd.OpenForm stDocName, , , stLinkCriteria

Very straight forward, but for the life of me, I cannot figure out why
it brings up the text entry box asking for a parameter, with the box
title being the Me![Inquiry_Reference_Number]. When I added the msg
box, it displays the correct string that I want as my link criteria, so
it makes no sense to me why it brings up the parameter entry box.

Any help provided would be greatly appreciated!
 
A

Albert D. Kallal

stLinkCriteria = "[Inquiry_Reference_Number] = " &


1st question:
is there a field in the forms table called above? (we are talking about the
form of fInquiries)

2nd question:

is there a text box on your form called: [Inquiry_Reference_Number] ?

Further, use me.Inquiry_Reference_Number (let inteli sense produce the list
for you).

3 question:
is Inquiry_Reference_Number a number type field, or text type field (as
defined in the table)? If this is text type field, then you need to surround
the value with quotes eg:


stLinkCriteria = "[Inquiry_Reference_Number] = '" &
Me.Inquiry_Reference_Number & "'"
 
D

Douglas J. Steele

Does it make a difference if you move the DoCmd.Close to after the
DoCmd.OpenForm statement?
 

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