How do I pass a parameter to an unbound form?

  • Thread starter AkAlan via AccessMonster.com
  • Start date
A

AkAlan via AccessMonster.com

I have a form with 3 continuous subforms that each have textboxes. Sometimes
they have more data than can be shown without making the textbox relly large.
I want to have the user doubleclick the text box to open another form with a
really large textbox and dynamically supply the recordsource and criteria. I
will post the event code that I am trying to make work. All I get is a blank
form. Any help would be great.

Dim stDocName As String
Dim stLinkCriteria As String
If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord

Form_frmCarTextPopUp.RecordSource = "q_QcCarDiscrepancy"
Form_frmCarTextPopUp.txtExpanded.ControlSource = "Discrepancy"
stDocName = "frmCarTextPopUp"
stLinkCriteria = "[CarInspNum]=" & "'" & Me![txtCarNum] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormReadOnly
 
B

Beetle

I don't believe you can assign the recordsource, or the control source
of any of the controls, until after the form is opened. That also means
you won't be able to apply any criteria until afterwards either. You might
try something like;


DoCmd.OpenForm "frmCarTextPopUp", , , , acFormReadOnly

With Forms!frmCarTextPopUp
.RecordSource = "q_QcCarDiscrepancy"
.Controls("txtExpanded").ControlSource = "Discrepancy"
.Filter = "[CarInspNum]=""" & Me![txtCarNum] & """"
.FiltetOn = True
End With
 
A

AkAlan via AccessMonster.com

I tried it but it opened a different record and errored on the .filteron =
true.
I don't believe you can assign the recordsource, or the control source
of any of the controls, until after the form is opened. That also means
you won't be able to apply any criteria until afterwards either. You might
try something like;

DoCmd.OpenForm "frmCarTextPopUp", , , , acFormReadOnly

With Forms!frmCarTextPopUp
.RecordSource = "q_QcCarDiscrepancy"
.Controls("txtExpanded").ControlSource = "Discrepancy"
.Filter = "[CarInspNum]=""" & Me![txtCarNum] & """"
.FiltetOn = True
End With
I have a form with 3 continuous subforms that each have textboxes. Sometimes
they have more data than can be shown without making the textbox relly large.
[quoted text clipped - 12 lines]
stLinkCriteria = "[CarInspNum]=" & "'" & Me![txtCarNum] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormReadOnly
 
A

AkAlan via AccessMonster.com

I'm not sure it matters but I am using an ADP
I don't believe you can assign the recordsource, or the control source
of any of the controls, until after the form is opened. That also means
you won't be able to apply any criteria until afterwards either. You might
try something like;

DoCmd.OpenForm "frmCarTextPopUp", , , , acFormReadOnly

With Forms!frmCarTextPopUp
.RecordSource = "q_QcCarDiscrepancy"
.Controls("txtExpanded").ControlSource = "Discrepancy"
.Filter = "[CarInspNum]=""" & Me![txtCarNum] & """"
.FiltetOn = True
End With
I have a form with 3 continuous subforms that each have textboxes. Sometimes
they have more data than can be shown without making the textbox relly large.
[quoted text clipped - 12 lines]
stLinkCriteria = "[CarInspNum]=" & "'" & Me![txtCarNum] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormReadOnly
 
D

Dennis

I usually just code that in VBA, using ADO lookup methodology. Works like a
charm.
 
A

AkAlan via AccessMonster.com

Do you have an example? Thanks.
I usually just code that in VBA, using ADO lookup methodology. Works like a
charm.
I have a form with 3 continuous subforms that each have textboxes. Sometimes
they have more data than can be shown without making the textbox relly large.
[quoted text clipped - 12 lines]
stLinkCriteria = "[CarInspNum]=" & "'" & Me![txtCarNum] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormReadOnly
 

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