populating form from query

Andromeda31

Registered User.
Local time
Today, 16:20
Joined
Oct 14, 2009
Messages
33
Posted last week for help with getting my datasheet to requery.

I have also got a button that opens a query so the records displayed in the datasheet can be edited. The one drawback at the moment is that the datasheet view isn't suitable for editing all the fields as the original form populates some of the fields from combo boxes drawing the data from linked tables.

My solution for this is to open a form when the individual rows in the datasheet are clicked with the form being based on the original form with the combo boxes.

The on click code I am using to open the form is:
Code:
    Dim stDocName As String
    Dim stLinkCriteria As String
    
    'Open form to see full details
    stDocName = "frmName"
    
    stLinkCriteria = "[field]=" & Me![Field]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

The button that opens the query on which the form will be based is filtering the records by the client open on the main form, but if I am opening a form using the above I would need to also filter by record_ID so the form is populated with one record's data. Do I do this by defining stLinkCriteria more effectively? Do I need to put criteria in the record_ID column of the query as well in the same way I filtered by client_ID?


If I can get the form to work, I could then do away with the query opening button.

I see from the thread Frustrated with datasheet view there are ways to get combo dropdowns to work, but I think in this instance a new form may be more elegant.

MTIA
Andromeda31
 
Amazingly, this adding the correct field to the stLinkCriteria line actually works now I have added a form based on the query I was opening with the 'edit' query button... and clicking on the field where the On Click() has the above code opens a form with the corresponding record_ID.

cheers
Andromeda31
 

Users who are viewing this thread

Back
Top Bottom