Editing records with forms

Bobadopolis

No I can't fix it dammit!
Local time
Today, 07:51
Joined
Oct 6, 2005
Messages
77
Hi everybody,

I have a large problem which I can't figure out (well 2 actually but the other is less important):

1) I have a form which brings up the results of a search performed by the user (only contains some fields). From this list of results i would like the user to be able to a) see a full report of that Record (which I've done ok) and b) edit the data contained in that Record.

My results form opens the editing form no problems, however, i cannot edit any of the data contained within it. This only occurs when the results form is open as well so i guess it's because there are two instances of those fields open simultaneously. However, I am reluctant to close the results form because the results will be lost.

2) I've tried several methods to open the form at the desired record:
- using the WHERE condition argument of the OpenForm function
- creating a filter in the editing form that runs in the OnOpen event
These two require the creation of a variable (I'm using the Key field) that is inserted into these bits of code. However, all of my attempts thus far have been unsuccessful; every time it asks for the Parameter in a popup. I've defined the variable as a Public variable in a seperate module but don't really understand this aspect partcularly well; I'm obviously missing something.
- the form currently opens from it's own query that gets the Key Field Criteria form a hidden control on the results form.

Here is my code for the 'Edit' button:

Public stProjectID As String

'Results form 'Edit' button click:
Private Sub btnEdit_Click()
stProjectID = txtID2
[Forms]![frmResults].Visible = False
DoCmd.OpenForm "frmProjectEdit", acNormal
End Sub

'Edit' form open:
Private Sub Form_Open(Cancel As Integer)
Me.Filter = "ProjectID = stProjectID"
FilterOn = True
End Sub

Sorry for waffling on...

Thanks in advance for your help.

Bobadopolis
 
Bobadopolis said:
My results form opens the editing form no problems, however, i cannot edit any of the data contained within it. This only occurs when the results form is open as well so i guess it's because there are two instances of those fields open simultaneously. However, I am reluctant to close the results form because the results will be lost.

Are you getting a particular error message?
For the Results Form, what is the setting you have on Form\Data\Record Locks ?
 
D'OH!!!!

The form was almost completely locked!

However, i can edit the data only when the RecordSource is set to the original table, not the query as it was(?) meaning the results form cannot link to the selected record anymore.

If I now want to link to that record in the 'edit' form how do I go about implementing an alternative solution, i.e. using the WHERE condition argument of OpenForm or Filter function (using a variable). The popups are jus the standard popups saying 'Enter Parameter Value' followed by the variable name. It's obviously not defined i guess; how do i do this?

Thanks a lot,

Bobadopolis
 

Users who are viewing this thread

Back
Top Bottom