|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Hi,
I'm starting with Microsoft Access and lots of things work and with lots of others I have to learn a lot. So what I'm trying to do now is to speed up the entry of a new record in a table. I'm already managed to update certain fields according to the entry in other fields, but I now want to update ALL values of the new record from the last record entered. I'm close to the solution, but it just doesn't work I've entered the following code: Private Sub Load_last_Click() Dim sql As String Dim ID_n As Integer Dim m_instruction As String Dim my_record As Recordset m_instruction = "Select Max([Master database].ID) AS Analysis_file_name FROM [Master database]" sql = m_instruction ' Open the recordset Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset rs.Open sql, CurrentProject.Connection ID_n = rs![Analysis_file_name] [Analysis_file_names].SetFocus [Analysis_file_names].Text = ID_n 'Fills in the field Analysis_file_names with the value of the last ID rs.Close End Sub Which works, but does not do what I would like... It put the value of the ID in a record named "Analysis_file_names". What I would like to do is to take from the last record the values of field1 and put then in the new field1, and so on for all the fields. Suggestions? Comments? please... I've tried other options I found in other posts, but these were not working. I should add that I'm using MS-Access 2002-SP2 Thanks, helder-pinco |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Updating fields with last entry |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|