Passing field on one form to field on another form (1 Viewer)

Johnny Drama

In need of beer...
Local time
Today, 07:52
Joined
Dec 12, 2008
Messages
211
This is probably so simple it's stupid, but I can't figure it out for the life of me. I have a command button on a form which when clicked I would like it to open a second form and pass the value in the "controlnumber" field on form A to "controlnumber" field on form B. The code I'm using below keeps asking for a parameter...I just want what's in the field passed. I've been punching myself in the nuts over this all morning...

Private Sub convobtn_Click()
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Conversation"
stLinkCriteria = "Me.ControlNumber = Forms!Conversation!ControlNumber"
DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria, , acDialog

End Sub
 

spikepl

Eledittingent Beliped
Local time
Today, 16:52
Joined
Nov 3, 2010
Messages
6,142
Nut punching seldom leads to a solution. Have you considered a revolutionary approach: looking up DoCmd.OpenForm in the documentation or googling it, and following one of the numerous examples to the letter, meaning character by character?
 

TrevorSmile

New member
Local time
Today, 15:52
Joined
Apr 21, 2012
Messages
2
in the second form set the default value of the required field to the field in the first form ie =Forms!FormName!FieldName
 

Johnny Drama

In need of beer...
Local time
Today, 07:52
Joined
Dec 12, 2008
Messages
211
Trev,

Thanks for the suggestion, but that didn't seem to work. Kept tinkering and finally got it. Thanks for pointing me in the right direction.
 
Last edited:

Johnny Drama

In need of beer...
Local time
Today, 07:52
Joined
Dec 12, 2008
Messages
211
Nut punching seldom leads to a solution. Have you considered a revolutionary approach: looking up DoCmd.OpenForm in the documentation or googling it, and following one of the numerous examples to the letter, meaning character by character?

I have a revolutionary approach for you...try not being an ahole.
 

Users who are viewing this thread

Top Bottom