desperateUser
Technical User
I have an Excel Template that exports data to an mdb. Even though I have the
in my Form_Open event, the form opens to the last saved record, not the record the Excel template just put in the table.
Here is my Excel module:
This puts everything in the table just fine, but I need the form to open with this recordset so the user can add something to the information in Access. Any ideas where I'm going wrong?
TIA!
Penelope
Code:
DoCmd.GoToRecord, acDataForm, "frmLPO", acLast
Here is my Excel module:
Code:
Sub mcrOpenAccess()
Dim RetVal
Dim db As Database
Dim RS As Recordset
Dim strOrderID As String
RetVal = Shell("""C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"" ""J:\PROJECTS\PTDb\SRT.mdb""", 1)
Set db = OpenDatabase("J:\PROJECTS\PTDb\SRT.mdb")
' open the database
Set RS = db.OpenRecordset("tblLPOs")
' Add a new record into the database
With RS
.AddNew ' create a new record
' add values to each field in the record
RS("Account") = Range("Sheet1!F2").Value
RS("Center") = Range("Sheet1!G2").Value
RS("Requestor") = Range("Sheet1!D2").Value
RS("Comments") = Range("Sheet1!I2").Value
RS("PROJ_ID") = Range("Sheet1!N2").Value
RS("IBIS-Req") = Range("Sheet1!E2").Value
RS("VendorNo") = Range("Sheet1!K2").Value
RS("Contract") = Range("Sheet1!O2").Value
RS("Date Issued") = Range("Sheet1!B2").Value
RS("IBISShipTo") = Range("Sheet1!Q2").Value
RS("IBISFund") = Range("Sheet1!R2").Value
RS("IBISBuyerInitials") = Range("Sheet1!S2").Value
RS("WOReqID") = Range("Sheet1!P2").Value
.Update
.Bookmark = .LastModified
End With
RS.Close
End Sub
This puts everything in the table just fine, but I need the form to open with this recordset so the user can add something to the information in Access. Any ideas where I'm going wrong?
TIA!
Penelope