Linking Table Data by Form Actions

M

Mike

I have a form that contains record number information and alittle bit of data
based on this record number. Each "record number" is linked to a couples
information. This couples information is things like name, address, city,
etc. When I'm on the first form, we'll call "Protocol_Index", I hand type a
protocol number to designate this unique record. Once I've placed this
protocol number in the "Protocol_Index" form, there's a button that takes me
to another form, we'll call "Couple_Index". Once I get to the "Couple_Index"
form I would like the protocol number that I fed into the "Protocol_Index"
form to automatically link to this record. Is this possible and if so how?
I was able to do this in the past and for some reason or another its not
working. Any suggestions?
 
R

Rick A.B.

I have a form that contains record number information and alittle bit of data
based on this record number.  Each "record number" is linked to a couples
information.  This couples information is things like name, address, city,
etc.  When I'm on the first form, we'll call "Protocol_Index", I hand type a
protocol number to designate this unique record.  Once I've placed this
protocol number in the "Protocol_Index" form, there's a button that takes me
to another form, we'll call "Couple_Index".  Once I get to the "Couple_Index"
form I would like the protocol number that I fed into the "Protocol_Index"
form to automatically link to this record.  Is this possible and if so how?  
I was able to do this in the past and for some reason or another its not
working.  Any suggestions?

Mike,

You want to use a link criteria in your onclick event code when
opening the "Couple_Index form.
Something like:

Private Sub cmdButton_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Couple_Index"

stLinkCriteria = "[field on Couple_Index that corresponds to
protocal number]=" & Me![name of field on current form containing
Protocal number]

DoCmd.OpenForm stDocName, , , stLinkCriteria

end sub

Look out for word wrap

Hope that helps
 
M

Mike

Thanks for the response Rick! However this didnt seem to help. I think this
can be accomplished by using the command button wizard as well but it still
doesnt seem to update on field in the Couples_Index form/table.

Within the Protocol_Index table/form, I have a field called ProtocolNumber
and ProtocolIndex. The ProtocolIndex is just an autonumber field to keep
track of the records, which also falls as the primary key to the table.
Within the Couples_Index table I've placed the "ProtocolIndex" field in so it
would match with the one coming in from the Protocol_Index table/form. Does
this make any sense?

Rick A.B. said:
I have a form that contains record number information and alittle bit of data
based on this record number. Each "record number" is linked to a couples
information. This couples information is things like name, address, city,
etc. When I'm on the first form, we'll call "Protocol_Index", I hand type a
protocol number to designate this unique record. Once I've placed this
protocol number in the "Protocol_Index" form, there's a button that takes me
to another form, we'll call "Couple_Index". Once I get to the "Couple_Index"
form I would like the protocol number that I fed into the "Protocol_Index"
form to automatically link to this record. Is this possible and if so how?
I was able to do this in the past and for some reason or another its not
working. Any suggestions?

Mike,

You want to use a link criteria in your onclick event code when
opening the "Couple_Index form.
Something like:

Private Sub cmdButton_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Couple_Index"

stLinkCriteria = "[field on Couple_Index that corresponds to
protocal number]=" & Me![name of field on current form containing
Protocal number]

DoCmd.OpenForm stDocName, , , stLinkCriteria

end sub

Look out for word wrap

Hope that helps
 

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