Full Version: Saving Data To Split Database With Dao
UtterAccess Forums > Microsoft® Access > Access Forms
I have the following code in a buttons Click event.
Private Sub btnSubmit_Click()

Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("tblMain", dbOpenTable)
rst!Location = UCase(Me.cboLocation)
rst!DateTimeEntered = Now()
rst!PartNumber = UCase(Me.txtPartNumber)
rst!Qty = Me.txtQty
rst!RequestedBy = UCase(Me.txtRequestedBy)
Set rst = Nothing

'Clear textboxes
Me.txtDateEntered.Value = ""
Me.txtPartNumber.Value = ""
Me.txtQty.Value = ""
Me.txtRequestedBy.Value = ""


End Sub

I decided to split my database, and now the code doesn’t work.

Is there an easy way to edit this so that it will work with my split DB? tblMain is now in PartsMessenger_be.accdb
Hi. How exactly did you split your database? That code should still work if your table is linked to the backend. What does "doesn't work" mean? Were you getting any errors?
I was thinking it should still work too. I split the database by going to Database Tools, Access Database, Split Database.

When I click on button, I get an error that says 'Run-time error '3219' Invalid operation" When I click debug its highlights the following line.
Set rst = CurrentDb.OpenRecordset("tblMain", dbOpenTable)
Ahh....I found it. I removed the dbOpenTable and now it works.
Ah, maybe the dbOpenTable is causing it. I've never used that before. Try replacing it with something like dbOpenDynaset.

Edit: Oops, looks like we were posting at the same time. Glad to hear you got it sorted out.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.