johnmadigan
asked on
access open another db & form on last record
I have a button on my switchboard that opens a second database. I would like the second database to open on a paticular form & the last record of the form. Here is the query for opening the second db:
Private Sub Command54_Click()
Dim strDB As String, appAccess As Access.Application
strPath = "\\Fileserver\is_data\Docu mentation\ IT-Private \Schedulin g DB\WIP\3-25-10 WIP\"
strDB = strPath & "Schedulingdb_ShipSplitBat ch.accdb"
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Appli cation")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatab ase strDB
appAccess.Visible = True
appAccess.UserControl = True '
End Sub
Any suggestions?
Private Sub Command54_Click()
Dim strDB As String, appAccess As Access.Application
strPath = "\\Fileserver\is_data\Docu
strDB = strPath & "Schedulingdb_ShipSplitBat
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Appli
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatab
appAccess.Visible = True
appAccess.UserControl = True '
End Sub
Any suggestions?
if your table on which the form is based has a field, e.g. named "date", with the date of creation for a record you can add this to reverse the order (get the last record)
appAccess.Forms.Item("Form X").OrderB y("date DESC")
the same can be done with an autonumber field, e.g named "ID"
appAccess.Forms.Item("Form X").OrderB y("ID DESC")
appAccess.Forms.Item("Form
the same can be done with an autonumber field, e.g named "ID"
appAccess.Forms.Item("Form
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ah yeah my bad, that would be easier.
Dim strDB As String, appAccess As Access.Application
strPath = "\\Fileserver\is_data\Docu
strDB = strPath & "Schedulingdb_ShipSplitBat
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Appli
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatab
appAccess.Visible = True
appAccess.UserControl = True '
appAccess.docmd.openform "formX" ' add this line
End Sub