Link to a value in a subform opened in datasheet view

J

jskernahan

Hi,

I have a subform (which opens in datasheet view) embedded in a main
form. On the main form I have a button that opens a pop-up form. I
want to be able to select a value in the subform, click the button on
the main form, and output the value selected on the subform into the
main form. I have the following code written:

Private Sub Command1_Click()

Dim where As String

where = "[UWI] = " & Query!sfrmAvailToLic_Estimated_Date!UWI
DoCmd.OpenForm "popupfrm_PM_Comments", , , where

End Sub

when I run the code, I get the following compiler error:
Qualifier must be collection

I believe the error is in the line Query!sfrmAvailToLic_Estimated_Date!
UWI but I cannot figure out how to fix it, please help!!! thanks
 
J

jskernahan

sorry, my code actually reads:

Private Sub Command1_Click()

Dim where As String

where = "[UWI] = " & Forms!sfrmAvailToLic_Estimated_Date!UWI
DoCmd.OpenForm "popupfrm_PM_Comments", , , where

End Sub

and the error I get is:

Cannot find form sfrmAvailToLic_Estimated_Date, but i assure you the
form is created. I think it has something to do with the fact that it
is opened in datasheet view??
 

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