how update form?

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
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
 
Back
Top