Sub Form Updating

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
 
G

Guest

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
 
G

Guest

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
 

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