Create a form to modify a record in a table

  • Thread starter Thread starter Bob Paup
  • Start date Start date
B

Bob Paup

In access 2003 I used a combo box to go to the record but it just goes to the
table and adds a record.
 
In access 2003 I used a combo box to go to the record but it just goes to the
table and adds a record.

Then correct the error in your code.

If you would like help doing so please post the code.
 
I created a form that has two combo boxes. One searches for the LName in the
table LName and the other looks up the value of Status in the same table in
the record identified the the search for LName.

This is the code that executes After Update in the search for Combo 4:

Private Sub Combo4_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LName] = '" & Me![Combo4] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

This is the code that executes after update in the of the status for combo 8:

Private Sub Combo8_AfterUpdate()
Me.Combo8.DefaultValue = Chr(34) & Me.Combo8 & Chr(34)
End Sub

Bob
 
I created a form that has two combo boxes. One searches for the LName in the
table LName and the other looks up the value of Status in the same table in
the record identified the the search for LName.

This is the code that executes After Update in the search for Combo 4:

Private Sub Combo4_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LName] = '" & Me![Combo4] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

This is the code that executes after update in the of the status for combo 8:

Private Sub Combo8_AfterUpdate()
Me.Combo8.DefaultValue = Chr(34) & Me.Combo8 & Chr(34)
End Sub

The second sub just sets its own defaultvalue property (so that when you move
to the new record that record will default to the most-recently-picked status
in another record).

If that's not what you want to happen please explain.
 
I am trying to display the current "status" and possibly change this value
in the record that the first sub finds. The result of this code is that a
new record is created with "LName" and "Status". The search for the record
that contains "LName" does not work.

John W. Vinson said:
I created a form that has two combo boxes. One searches for the LName in the
table LName and the other looks up the value of Status in the same table in
the record identified the the search for LName.

This is the code that executes After Update in the search for Combo 4:

Private Sub Combo4_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[LName] = '" & Me![Combo4] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

This is the code that executes after update in the of the status for combo 8:

Private Sub Combo8_AfterUpdate()
Me.Combo8.DefaultValue = Chr(34) & Me.Combo8 & Chr(34)
End Sub

The second sub just sets its own defaultvalue property (so that when you move
to the new record that record will default to the most-recently-picked status
in another record).

If that's not what you want to happen please explain.
 
I am trying to display the current "status" and possibly change this value
in the record that the first sub finds. The result of this code is that a
new record is created with "LName" and "Status". The search for the record
that contains "LName" does not work.

Sounds like your first combo box is bound - it should have nothing in its
Control Source property.

Perhaps you have also set the form's Data Entry property to Yes - this will
cause it to open with a new record showing. Change it to No if that's the
case.
 
John
Thanks that makes it work. Now I want the combobox to not retain the value
that I entered after it gets used. In otherwords be null when it is complete.
 
John
Thanks that makes it work. Now I want the combobox to not retain the value
that I entered after it gets used. In otherwords be null when it is complete.

I don't understand. You want to update the Status to a new value, but have
that value then become null? or do you just not want to display this record on
the form once it's complete?
 
Back
Top