Hi
I had this working but seem to have done something, which I can't figure out, that has changed that.
I'm trying to set up a database that will be easy to add forms to. To do this I have set up a table with all the form names, the title to appear in the header, and the record source.
The set up is very similar for all the forms. There is a continuous form showing the data, and a single form that I use for adding records or editing records.
The problem is opening that form when I want to use it to edit records.
The edit form (single form) is opened when textbox A is clicked. I want the single form to open on the record that was clicked. The code that I am using to do that is
The first two lines deal with getting the name of the form to open and they work fine. This is just a test to get the code figured out so I'm using a test table for data.
A is the field in the table that contains the data I want to match. So, when I click on the field in the continuous form that contains A, I want it to open the single form to the same record that I clicked on.
Me.A is the value of the of the specific text control I am clicking on in the continuous form.
The recordsource for the form is set using
Where strRecordSource is a variable defining the recordsource
The problem is that all of that opens the single form at the first record in the table and not the one that I click on.
Thanks for any advice you might be able to offer
I had this working but seem to have done something, which I can't figure out, that has changed that.
I'm trying to set up a database that will be easy to add forms to. To do this I have set up a table with all the form names, the title to appear in the header, and the record source.
The set up is very similar for all the forms. There is a continuous form showing the data, and a single form that I use for adding records or editing records.
The problem is opening that form when I want to use it to edit records.
The edit form (single form) is opened when textbox A is clicked. I want the single form to open on the record that was clicked. The code that I am using to do that is
Code:
Private Sub A_Click()
strTitle = DLookup("Opens", "tblNavigation", "Title ='" & strTitle & "'")
strTitle = strTitle & "InputEdit"
DoCmd.OpenForm Title(), , , "A= '" & Me!A & "'", acFormEdit
End Sub
The first two lines deal with getting the name of the form to open and they work fine. This is just a test to get the code figured out so I'm using a test table for data.
A is the field in the table that contains the data I want to match. So, when I click on the field in the continuous form that contains A, I want it to open the single form to the same record that I clicked on.
Me.A is the value of the of the specific text control I am clicking on in the continuous form.
The recordsource for the form is set using
Code:
Me.Form.RecordSource = strRecSource
Where strRecordSource is a variable defining the recordsource
The problem is that all of that opens the single form at the first record in the table and not the one that I click on.
Thanks for any advice you might be able to offer