Form to select a particular record as another form for editing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have several linked tables, the main table has about 100 feilds.
I have only used access is some limited ways before.
I have designed a form (with 2 subforms) to input all the data and I have
made it similar to the paper form the client fills in in the first place and
all fits on a single screen and that works fine for new records .
BUT i need to be able to select a particular existing record by its unique
identifier (a3letter3digit code) and then open up a form to allow more data
to be added as and when it is available. I just do not seem to be able to do
this.
I tried a select query but that displays the data from just the one table in
a 1by 100 table (hopeless for data input).
So I then need to be able to populate my data entry form with the data from
the select query.
And it seems too basic a question for the discussion list.
Please could someone tell me what to do in what order.
 
Hi Lynn

Create a combo box that holds the ID fields in the 1st column (and anything
else you want the other columns. On the after update event place this code

Private Sub ComboName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[IDField] = " & Str(Me![ComboName])
Me.Bookmark = rs.Bookmark
End Sub

Or - If you want to open a new form to a specific record there are a number
of ways to do this. You could use the method above to go to the record and
then use this (on a button) to open another popup form to enter data
regarding the specific record.

Private Sub ButtonName_Click()
On Error GoTo Err_ButtonName_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FormNameToOpen"
stLinkCriteria = "[IDFieldOnNewForm]=" & Me![IDField]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_ButtonName_Click:
Exit Sub
Err_ButtonName_Click:
MsgBox Err.Description
Resume Exit_ButtonName_Click
End Sub


Hope this helps
 
Wayne-I-M said:
Hi Lynn

Create a combo box that holds the ID fields in the 1st column (and anything
else you want the other columns. On the after update event place this code

Private Sub ComboName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[IDField] = " & Str(Me![ComboName])
Me.Bookmark = rs.Bookmark
End Sub

Or - If you want to open a new form to a specific record there are a number
of ways to do this. You could use the method above to go to the record and
then use this (on a button) to open another popup form to enter data
regarding the specific record.

Private Sub ButtonName_Click()
On Error GoTo Err_ButtonName_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FormNameToOpen"
stLinkCriteria = "[IDFieldOnNewForm]=" & Me![IDField]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_ButtonName_Click:
Exit Sub
Err_ButtonName_Click:
MsgBox Err.Description
Resume Exit_ButtonName_Click
End Sub


Hope this helps


--
Wayne
Manchester, England.
Enjoy whatever it is you do


Lynn said:
I have several linked tables, the main table has about 100 feilds.
I have only used access is some limited ways before.
I have designed a form (with 2 subforms) to input all the data and I have
made it similar to the paper form the client fills in in the first place and
all fits on a single screen and that works fine for new records .
BUT i need to be able to select a particular existing record by its unique
identifier (a3letter3digit code) and then open up a form to allow more data
to be added as and when it is available. I just do not seem to be able to do
this.
I tried a select query but that displays the data from just the one table in
a 1by 100 table (hopeless for data input).
So I then need to be able to populate my data entry form with the data from
the select query.
And it seems too basic a question for the discussion list.
Please could someone tell me what to do in what order.
 
My knowledge is too limited to understand what you were suggesting but I gave
it a go, probably not as you had intended.
I added a combo box, in place of the SubjID field, to a copy of my original
form and it seemed to work and there was already the following in the After
update box

Private Sub Combo181_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[SubjID] = '" & Me![Combo181] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

I changed it to what I believe you suggested

Private Sub Combo181_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[SubjID] = " & Str(Me![Combo181])
Me.Bookmark = rs.Bookmark
End Sub

(because I had not idea what the differences would mean) and it stopped
working. So I changed it back to what it had automatically created. The only
thing is when the form initially opens up it contains the data for the first
record and if you do not use the combo box to select the subject you wish to
work on then it is possible to accidentally edit the information on the first
record. If I could clear the form (and its two subforms) of all data I think
I would have a form that would do the job. I do not need anything fancy just
something that means we can easily go to a particular record and look up the
persons address (the first subform relates to a linked table on a separate
disk to protect peoples identity) OR enter any data that we obtain after the
initial record is input. The second sub-form relates to a one to many table
that holds the list of products used. I am not sure I have set up the
relationships properly. Is it possible to have referential integrity with a
linked table.


Wayne-I-M said:
Hi Lynn

Create a combo box that holds the ID fields in the 1st column (and anything
else you want the other columns. On the after update event place this code

Private Sub ComboName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[IDField] = " & Str(Me![ComboName])
Me.Bookmark = rs.Bookmark
End Sub

Or - If you want to open a new form to a specific record there are a number
of ways to do this. You could use the method above to go to the record and
then use this (on a button) to open another popup form to enter data
regarding the specific record.

Private Sub ButtonName_Click()
On Error GoTo Err_ButtonName_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FormNameToOpen"
stLinkCriteria = "[IDFieldOnNewForm]=" & Me![IDField]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_ButtonName_Click:
Exit Sub
Err_ButtonName_Click:
MsgBox Err.Description
Resume Exit_ButtonName_Click
End Sub


Hope this helps


--
Wayne
Manchester, England.
Enjoy whatever it is you do


Lynn said:
I have several linked tables, the main table has about 100 feilds.
I have only used access is some limited ways before.
I have designed a form (with 2 subforms) to input all the data and I have
made it similar to the paper form the client fills in in the first place and
all fits on a single screen and that works fine for new records .
BUT i need to be able to select a particular existing record by its unique
identifier (a3letter3digit code) and then open up a form to allow more data
to be added as and when it is available. I just do not seem to be able to do
this.
I tried a select query but that displays the data from just the one table in
a 1by 100 table (hopeless for data input).
So I then need to be able to populate my data entry form with the data from
the select query.
And it seems too basic a question for the discussion list.
Please could someone tell me what to do in what order.
 
Back
Top