Links to records

  • Thread starter Thread starter Caroline
  • Start date Start date
C

Caroline

Hello,
I am trying to link the case numbers (in a table or form) to the case detail
form, going directly to that case number instead of the begining of the form.
How do I do that?
Thank you,
Caroline
 
You should have a relationship between the two tables based
on the Case number (assuming that is the PK value). Then you
would typically use a form/sub form arrangement where the
main form is based on the Case table and the sub form is based
on the Case Detail table, using CaseNumber as the Master/Child
link.
 
Thank you. Sorry, I was too brief.
I am using the "issue tracking" template as my example -but I'm starting
from scratch because I don't want everything the template has.
I have a case table, with the associated form, "case details". I also have a
client table (with a relationship to the case table); I have a form based on
the client table. In that form, I have all the cases related to a particular
client. I want those cases to display a link that, when clicked, would get me
to the "Case details" form -to the right case number.
 
OK. You can use the Where argument of the OpenForm method.

On the sub form that shows all the Cases for a particular Client
you could have, for example, a command button with code like
the following;

Private Sub cmdDetails_Click ()

DoCmd.OpenForm "frmCaseDetails", , , "CaseNumber=" & Me![CaseNumber]

End Sub

The above assumes that CaseNumber is an integer. If it is text
you will need to add additional quote delimiters like;

DoCmd.OpenForm "frmCaseDetails", , , "CaseNumber=""" & _
Me![CaseNumber] & """"

That's three double qoutes after the = sign and four double
quotes at the end. I have added the continuation character
(the underscore) because of the newsgroup line wrap.

If you're not that familiar with code, the command button
wizard can guide you through the process.
 
Back
Top