rigor via AccessMonster.com said:
Thanks, field which i use to uniquely identify records is serial number
OK, but how are you selecting the source and target records?
Suppose, for example, you've selected the source record in a combo box
called "cboSource" and the target record in a combo box called "cboTarget".
The code to build the SQL statement might then look something like so
(assuming that SerialNumber is a text field) ...
strSql = "UPDATE YourTableName SET YourFieldName = (SELECT YourFieldName
FROM YourTableName WHERE SerialNumber = '" & Me.cboSource & "') WHERE
SerialNumber = '" & Me.cboTarget & "'"
Alternatively, if your combo box includes a column that has the port number,
you can get the source port number from there, and eliminate the subquery
from the SQL statement ...
strSql = "UPDATE YourTableName SET YourFieldName = '" &
me.cboSource.Colmn(1) & "' WHERE SerialNumber = '" & Me.cboTarget & "'"
This assumes that cboSource has two columns and its rowsource is something
like ....
SELECT SerialNumber, PortNumber FROM YourTable
The Column property is zero based, so Column(0) refers to the first column,
Column(1) to the second column, etc.
Brendan said:
How to call two records from one table in one form and replace record
from
single field to another. For example, i have record with computer
[quoted text clipped - 3 lines]
Thanks for advance,
rigor
Dim db As DAO.Database
Dim strSql As String
stgrSql = "UPDATE YourTableName SET YourFieldName = (SELECT YourFieldName
FROM YourTableName WHERE <insert the criteria to select the source record
here>) WHERE <insert the criteria to select the target record here>
Set db = CurrentDb
db.Execute strSql
I can't tell you what the "criteria to select" bits would be, without
knowing which field or combination of fields uniquely identify the source
and target records.