stLinkCriteria

P

Pass-the-Reality

On my switchboard I have a command button that says

stDocName = "frmCertificationIssueDetail"
stLinkCriteria = "[CallLogID]=" & Me![XXXXXX]
DoCmd.OpenForm stDocName, , , stLinkCriteria

[CallLogID] is a field on frmCertificationDetail. I want [XXXXXX] to pop up
a parameter value. How do I need to adjust my code?
 
D

Douglas J. Steele

One approach would be:

stLinkCriteria = "[CallLogID] = " & InputBox("What Call Log ID?")

However, that isn't all that robust, as it won't handle the case where they
change their mind and hit Cancel.

Better might be

Dim strLogId

stDocName = "frmCertificationIssueDetail"
strLogId = InputBox("What Call Log ID?")
If Len(strLogId) > 0 Then
stLinkCriteria = "[CallLogID]=" & strLogId
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

That assumes that CallLogID is a numeric field. If it's text, change the 4th
line to

stLinkCriteria = "[CallLogID]='" & strLogId & "'"

Exagerated for clarity, that's

stLinkCriteria = "[CallLogID]= ' " & strLogId & " ' "
 

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