Form for editing records (1 Viewer)

brocsman

Registered User.
Local time
Today, 23:42
Joined
Nov 21, 2010
Messages
28
I'm trying to set up a form for editing records. My data entry form works fine, but now I need to be able to select a record, by name, location and date, and bring it into a form for editing/adding additional data.

I'm thinking I need an initial form to select the criteriia to identify the record, which will then open another form, which will display the contents of the selected record, and allow the user to edit it.

I woiuld then have two buttons, one to find another record, ie re-open the first form, the other to end the editing session.

I can't find a way to link the two forms, so that the values selected in the first form locate the relevant record for display in the second. I can get a form which displays all the records, starting at the top of the query, and allows editing, but I need the user to be able to select which record is displayed when the form opens.

All of this is based on a query, which seems to work fine. I've tried sending the contents of the combo boxes on the first form to the query, but I get a blank form when it opens. I'm sure I'm using the right data item names.

Help please.
 

SOS

Registered Lunatic
Local time
Today, 15:42
Joined
Aug 27, 2008
Messages
3,514
Why not just set up a combo box on the main form to select the record you want? You can even use the wizard to set it up for you. Or are you wanting to be able to search by different parts? If that's what you want, why not just use the Query By Form method. You can set up a button to activate it:

Code:
DoCmd.RunCommand acCmdFilterByForm

And then have a button to apply the filter:
Code:
DoCmd.RunCommand acCmdApplyFilterSort

And then you don't even need to make a different form.
 

brocsman

Registered User.
Local time
Today, 23:42
Joined
Nov 21, 2010
Messages
28
I'm sorry, I just can't follow that. Can you explain in a bit more detail.

Assume I have an existing dataset, and I want to find a single record to edit in my form. The criteria for finding this record are name, date and location, so I'm trying to create a form to gather these details from the user (ie to allow them to select these from displayed lists), then to use them to find the relevant record in the dataset, and open my editing form with that record displayed.

Sorry I'm being so stupid, but I need a step by step explanation. Do I need to write code, or can I do it without?



Why not just set up a combo box on the main form to select the record you want? You can even use the wizard to set it up for you. Or are you wanting to be able to search by different parts? If that's what you want, why not just use the Query By Form method. You can set up a button to activate it:

Code:
DoCmd.RunCommand acCmdFilterByForm
And then have a button to apply the filter:
Code:
DoCmd.RunCommand acCmdApplyFilterSort
And then you don't even need to make a different form.
 

smig

Registered User.
Local time
Tomorrow, 01:42
Joined
Nov 25, 2009
Messages
2,209
do you have a KeyField for each record, so you can know which record was selected on the first form ?
if you do you can query the second form based on the record selected in the first form.
in your second form's query grid use the KeyField's criteria and set it to something like:
Forms![MyFirstForm].[SelectedRecord]
 

Users who are viewing this thread

Top Bottom