DAO edit question

gguy

Registered User.
Local time
Today, 17:27
Joined
Jun 27, 2002
Messages
104
I have a form based on a query that adds a new record to a table called test_no. The query uses test_no to determine the last record ID and increments it by one for each new record. Then the user is required to enter an agency ID. The agency ID is joined in the query to the agency ID field on the agency table. In the query I include the agency name field and when the agency ID is enter on the form, the agency name appears on the form.

The form is bound to the query but the record ID and agency ID get updated on the test_no table when the record is saved. I want to append the agency name to the agency name field on the test_no table for the current record. I also want to append current date to the current date field on the test_no table.

I am new to VB but tried the following DAO edit function. It appended the agency name but it will only append it to the first record in the table....not the current record.

Dim DB As DAO.Database
Dim rs As DAO.Recordset
Set DB = CurrentDb
Set rs = DB.OpenRecordset("testno")
rs.Edit
rs("agency_nam").Value = [AGENCY_NAM]
rs.Update
Set DB = Nothing
Set rs = Nothing
Thanks, GGuy
 

Users who are viewing this thread

Back
Top Bottom