Re: Replace Values instead by FORM
- From: "John Spencer" <spencer@xxxxxxxxx>
- Date: Tue, 14 Aug 2007 07:21:55 -0400
TO get just one record
MyDb.OpenRecordset("SELECT * FROM TableName WHERE PrimaryKeyField=
SomeSpecificValue")
To update just one record
Currentdb().Execute "UPDATE TableName SET SomeField = SomeValue WHERE
PrimaryKeyField= SomeSpecificValue"
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
"ooxx" <ooxx@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4B9F9D64-75D5-49F8-98BC-B60F33E32297@xxxxxxxxxxxxxxxx
Hello,
Thanks for your help it works. By the way, I would like to update on a
certain record. Now, no movefirst or movelast or do unitl eof. Is there
anything like this? Update on a certain 'ID' .
Thanks,
"Ofer Cohen" wrote:
First BackUp your data.
Try this code
Function FillNumbers()
Dim MyDB As DAO.Database, MyRec As DAO.Recordset
Dim OldNum As Integer
Set MyDB = CurrentDb
Set MyRec = MyDB.OpenRecordset("Select * From TableName Order By
KeyField")
While Not MyRec.EOF
If MyRec!MyNum = 0 Then
MyRec.Edit
MyRec!MyNum = OldValue
MyRec.Update
Else
OldValue = MyRec!MyNum
End If
MyRec.MoveNext
Wend
End Function
Where:
MyNum = name of the field to be updated
KeyField = name of the field used to sort the records
--
Good Luck
BS"D
"ooxx" wrote:
Hi
It'd be appreciate if the "QUERY" can do instead of inputing values by
the
"FORM". The table is lack of the values, so I would like to place
them,
whether it could be done by the "QUERY". The values is as the same as
the
first beforehand records such as: 33, 0 ,0 ,0 34 ,0 ,0 , 35,
0,36,37,38,0,.... So the values to replace zero should be the one
before and
it should then be 33,33,33,33,34,34,34,35,35,36,37,38,38,...
Thanks,
.
- Follow-Ups:
- Re: Replace Values instead by FORM
- From: ooxx
- Re: Replace Values instead by FORM
- Prev by Date: Re: Selecting one of duplicate records with a maximum value.
- Next by Date: Re: Update Qry
- Previous by thread: hierarchical data - querying
- Next by thread: Re: Replace Values instead by FORM
- Index(es):
Relevant Pages
|