Re: Replace Values instead by FORM

Tech-Archive recommends: Speed Up your PC by fixing your registry



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,


.



Relevant Pages

  • Re: UPDATE TABLE FROM UNBOUND QUERY
    ... This buttons run the TestQuery and I can see the results. ... results of the query, I want to update the main data tale with Moved = Yes, ... Rather than trying to construct the SQL, use the Design view of the query ... AddTables --> TestQuery, Tablename ...
    (microsoft.public.access.modulesdaovba)
  • Re: Please help with a Query
    ... The query with the MIN would replace the query you were to add the HAVING ... SELECT studentID, MIN ... FROM tableName AS a INNER JOIN tableName AS b ... Since a rank of 1 is the minimum, you could do it simpler and faster ...
    (microsoft.public.access.queries)
  • Re: How do I count equal values as one?
    ... DCount is a function in ACCESS VBA that can be called from a query. ... Select Tools | References from the menu bar. ... > you mean TableName = the same tablename in both queries. ... >> SELECT idPlace AS P, ...
    (microsoft.public.access.queries)
  • Re: Month date offset query
    ... I am trying to query the projects so that I can align all of the ... Let's assume the StartDate is an actual Date/Time column (if it isn't you ... As HoursUsed From TableName ... DateSerial,month+1,1) As ReportingMonth ...
    (microsoft.public.access.queries)
  • Re: Totals Query
    ... Better to do it in multiple queries. ... FROM tableName As a INNER JOIN q2 ... with the LATEST EventDate of the BIGGEST FitID number for EACH Style ... I want to just tell the query to find ...
    (microsoft.public.access.queries)