Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

VB rs.addNew - read only?

Featured Replies

I'm testing out using VB to add records to a FileMaker database served from FMS via ODBC.

As part of this test I first decided to see if I could just query the records in a certain table and get back some results which works fine here's my code.....

Dim ws As Workspace

Dim db As database

Dim strConnection As String

Dim rs As Recordset

Set ws = DBEngine.Workspaces(0)

Let strConnection = "ODBC;DSN=TSHC" & DatabaseName & ";UID=Admin" & UserName & ";PWD=" & UserPassword

Set db = ws.OpenDatabase("", False, False, strConnection)

Set rs = db.openrecordset("ENGLISH_NATURE")

Do While Not rs.EOF

'Put the code here for what to do with the information.

'The field information can be access by the field name

intID = rs!ID

intTitle = rs!Title

'Or by the order number it is in the list (starting at 0)

MsgBox intID & " - " & intTitle

rs.MoveNext

Loop

The next part of the test was to see if I could create a record. Here's my code which results in the following error at the rs.addNew line: "Database or Object is read only". The database is not read only. I am using the Admin user to connect which has full access to the file and also has ODBC access privs.

Dim ws As Workspace

Dim db As database

Dim strConnection As String

Dim rs As Recordset

Set ws = DBEngine.Workspaces(0)

Let strConnection = "ODBC;DSN=TSHC2" & DatabaseName & ";UID=Admin" & UserName & ";PWD=" & UserPassword

Set db = ws.OpenDatabase("", False, False, strConnection)

'DAO - Add New Record

Set rs = db.openrecordset("ENGLISH_NATURE")

' ERROR OCCURS ON THE NEXT LINE...

rs.AddNew

rs!ID = intID

rs!Name = "Test"

rs!Status = "Popular"

rs!Author = "Graham Sprague"

rs!Publisher = "Somepublisher, Inc."

rs.Update

IIRC you will need to specify more options for the openrecordset. The way you have it coded here is read-only by nature. Do a search on MS Technet for the available options.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.