Sub Form Updating

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

On a form I have a sub form that lists records as a datasheet.
The user needs to be able to edit those records.
This is my code for a command button on the mainform - but how can I specify
one record shown on the subform. "RECORD PICKED FROM SUBFORM"


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "f_ProviderDetails"

stLinkCriteria = "[PROVNO]=" & "'" & Me![RECORD PICKED FROM SUBFORM] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria


Thanks
 
Subform "YES" but not on the main form which is where I need to place the
command button.

And Yes it is "Text" ont eh subform.

Suggestions??





SteveM said:
Do you have a PROVNO field on your subform?
Is it a text field or number?

Steve

Dan @BCBS said:
On a form I have a sub form that lists records as a datasheet.
The user needs to be able to edit those records.
This is my code for a command button on the mainform - but how can I specify
one record shown on the subform. "RECORD PICKED FROM SUBFORM"


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "f_ProviderDetails"

stLinkCriteria = "[PROVNO]=" & "'" & Me![RECORD PICKED FROM SUBFORM] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria


Thanks
 
Ok, something like this:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "f_ProviderDetails"

stLinkCriteria = "[PROVNO]=" & "'" & Me!mySubform!PROVNO & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria


Change mySubform to the name of your subform control.
I take it the PROVNO field in your table is also Text data type?

Steve

Dan @BCBS said:
Subform "YES" but not on the main form which is where I need to place the
command button.

And Yes it is "Text" ont eh subform.

Suggestions??





SteveM said:
Do you have a PROVNO field on your subform?
Is it a text field or number?

Steve

Dan @BCBS said:
On a form I have a sub form that lists records as a datasheet.
The user needs to be able to edit those records.
This is my code for a command button on the mainform - but how can I specify
one record shown on the subform. "RECORD PICKED FROM SUBFORM"


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "f_ProviderDetails"

stLinkCriteria = "[PROVNO]=" & "'" & Me![RECORD PICKED FROM SUBFORM] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria


Thanks
 
Back
Top