I seriously doubt that your "Dey" field is Status. Status was the field that
you indicated that you wanted to update for a selected record.
The "[Name of Key field from the Ledger table]" is the name of a field that
holds a unique value for each of your records in the "Ledger" table.
Normally this would be an "AutoNumber" type field that is automatically
incremented each time a user adds a record to the table.
Let's see if we can start from the top. How does the user select the record
that is to have the "Status" updated. If they are selecting this record from
a list box or a combo box, then the record source (query) must include the
unique value that will identify a specific record. The bound column for the
list box or combo box needs to be set to be that unique field. You can
display any other field(s) you like but the bound field needs to be the
unique (key) field. This wan, when the user selects a reocrd, the value of
the list box will be the unique (key) value for the selected record.
You would then use that value in the "WHERE" part of your sql statement.
Try something like this in the "AfterUpdate" event of the listbox or combox
where users are selecting the record to be updated. (This assumes that the
listbox or combo box has the Key value as the bound column.
Dim lngRecID as long
lngRecID = Me.NameOfYourListbox
mySQL = "UPDATE ledger Set Status = ""Matched"" WHERE YourKeyFieldName = " &
lngRecId & ""
CurrentDb.Execute mySQL
Be careful about the word wrapping in the sql statement. For now, just keep
it all on the same line.
The code above will read the value of the bound value for the selected
record, assign that value to a variable and then use that value in the SQL
statement.
I'm sorry, after all these, i am still having problem with this code. Ex) my
user compare the UnMatched record to their check register, and found out,
there is an adjustment. They will do whatever they have to do, and then
change the UnMatched to Match, because they made an adjustment.
But after reading your code and tried for many hours, it is still not working.
Could you explain to me one more time. Maybe i missed something from your
code, but i tried so many different way.
Private Sub CmdMatch_Click()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb()
mySQL = "UPDATE Ledger SET Status = ""Matched"" WHERE [Status] = '" & Status
& "' AND [Check_Num]"
CurrentDb.Execute mySQL
End Sub
Check_Num is not my primary key for this Ledger Table. sometimes there could
be two, because one is the cleared amount by the bank, and the other might be
adjustments. Manually, users will have to type delete UnMatched, and type
Matched, then its all set. Any easy way to just tell the cmd to change its
value???
I really appreciate your help on this.
>I seriously doubt that your "Dey" field is Status. Status was the field that
>you indicated that you wanted to update for a selected record.
[quoted text clipped - 38 lines]
>> >> >>
>> >> >> Thanks in advance.
Mr B - 06 Mar 2007 02:35 GMT
Ok, we'll take another shot at it.
First, i notice that you are declaring a recordset and and then using that
variable to open the recordset. If you are working in the current database,
then you do not need to do this. You can just create your sql statement and
then execute it.
You may need to send me a copy of your database so I can actually see what
you are doing and how your tables are designed.
If you want to send me a copy, then attach it to an email and send it to:
mrbpolknospamplease@suddenlink.net (just remove the no spam please)
I will be happy to look at it and see what we can do.

Signature
HTH
Mr B
> I'm sorry, after all these, i am still having problem with this code. Ex) my
> user compare the UnMatched record to their check register, and found out,
[quoted text clipped - 66 lines]
> >> >> >>
> >> >> >> Thanks in advance.
accessuser - 06 Mar 2007 04:00 GMT
I tried to send the database to you by email for 4 times, but all came back
failed. Is there anything that you see is missing on my code. I am running
this code on the VBA, right?
>Ok, we'll take another shot at it.
>
[quoted text clipped - 15 lines]
>> >> >> >>
>> >> >> >> Thanks in advance.
Mr B - 06 Mar 2007 13:27 GMT
Yes, the code is VBA. It is not clear with what event you are using the code.
There are several questions that need to be addressed to assist you. That
is why I suggested that you send me a copy of the database.
Did you remove the words "nospamplease" from the email addres I provided?
If you remove this phrase it will work: mrbpolknospamplease@suddenlink.net

Signature
HTH
Mr B
> I tried to send the database to you by email for 4 times, but all came back
> failed. Is there anything that you see is missing on my code. I am running
[quoted text clipped - 19 lines]
> >> >> >> >>
> >> >> >> >> Thanks in advance.