how update form?

G

Guest

Thanks for any help. I have a database with a table and form, and a button on
the form that takes some info from Bloomberg, with a Bloomberg add-in. The
button's VB code puts it into the table as the newest record. I would like
the form to then show the newest record after putting the new record in, and
have been trying to get it to work, but no luck. If you could take a look at
my code, and point out anything, I would really appreciate it. I've been
playing around with .MoveLast, and CurrentRecord, and BookMark, but haven't
had any results. Thanks:

The abbreviated code is: (I left in the stuff that I think is important)
Dim MyDB As Database, MyTable As Recordset
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set MyTable = MyDB.OpenRecordset("DLY_FINL", dbOpenTable)
With MyTable
.AddNew
![1yr US Tsy] = varBondResults(0, 0, 1)
.Update
.MoveLast
End With

Thanks again.
 
M

Marshall Barton

Ian said:
Thanks for any help. I have a database with a table and form, and a button on
the form that takes some info from Bloomberg, with a Bloomberg add-in. The
button's VB code puts it into the table as the newest record. I would like
the form to then show the newest record after putting the new record in, and
have been trying to get it to work, but no luck. If you could take a look at
my code, and point out anything, I would really appreciate it. I've been
playing around with .MoveLast, and CurrentRecord, and BookMark, but haven't
had any results. Thanks:

The abbreviated code is: (I left in the stuff that I think is important)
Dim MyDB As Database, MyTable As Recordset
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set MyTable = MyDB.OpenRecordset("DLY_FINL", dbOpenTable)
With MyTable
.AddNew
![1yr US Tsy] = varBondResults(0, 0, 1)
.Update
.MoveLast
End With


If you can use the form's recordset clone, then it's easy:

With Me.RecordsetClone
.AddNew
![1yr US Tsy] = varBondResults(0, 0, 1)
.Update
Me.Bookmark = .LastModified
End With
 
G

Guest

Thanks very much Marshall, that worked perfectly!


Marshall Barton said:
Ian said:
Thanks for any help. I have a database with a table and form, and a button on
the form that takes some info from Bloomberg, with a Bloomberg add-in. The
button's VB code puts it into the table as the newest record. I would like
the form to then show the newest record after putting the new record in, and
have been trying to get it to work, but no luck. If you could take a look at
my code, and point out anything, I would really appreciate it. I've been
playing around with .MoveLast, and CurrentRecord, and BookMark, but haven't
had any results. Thanks:

The abbreviated code is: (I left in the stuff that I think is important)
Dim MyDB As Database, MyTable As Recordset
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set MyTable = MyDB.OpenRecordset("DLY_FINL", dbOpenTable)
With MyTable
.AddNew
![1yr US Tsy] = varBondResults(0, 0, 1)
.Update
.MoveLast
End With


If you can use the form's recordset clone, then it's easy:

With Me.RecordsetClone
.AddNew
![1yr US Tsy] = varBondResults(0, 0, 1)
.Update
Me.Bookmark = .LastModified
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top