By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,929 Members | 1,830 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,929 IT Pros & Developers. It's quick & easy.

splitted database crashes when adding records to linked table

P: n/a
k
Hi all

I split a database in a table-part and a all-the-rest-part and linked
the tables, but my code adding records to a table crashes on

Set rs = db.OpenRecordset("tblDeltakelse", dbOpenTable,
dbAppendOnly)

I think, some places where I do the same thing to another table it just
says "Invalid Operation", I press OK and nothing happens, and I am just
as wise as to what operation was invalid.

I guess the OpenRecordset needs to know that it's supposed to open a
table that is linked, but I have no idea how to tell it that.

Anyone?
K

Nov 13 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
k wrote:
Set rs = db.OpenRecordset("tblDeltakelse", dbOpenTable,
dbAppendOnly)


Use dbOpenDynaset with linked tables.

--
--
Lyle
--
Nov 13 '05 #2

P: n/a
k
Thanks

But "method or data member not found"

I guess I should replace my line right before the openrecordset:
Set db = CurrentDb

with something else, to indicate that I am opening another db?

I'm a bit clueless here, nubi with this coding stuff in access

K

Nov 13 '05 #3

P: n/a
k wrote:
Thanks

But "method or data member not found"

I guess I should replace my line right before the openrecordset:
Set db = CurrentDb

with something else, to indicate that I am opening another db?

I'm a bit clueless here, nubi with this coding stuff in access

K


Are you sure you have a reference to DAO? What choices do you get from
the intellisense dropdown?

--
This sig left intentionally blank
Nov 13 '05 #4

P: n/a
k
I guess I'm in over my head here, my db was working fine, but I wanted
to split it to easier make updates.
I seem not to be able to answer your questions...

Q: Are you sure you have a reference to DAO
A: I'm not sure, I don't know what you mean, and really never got the
hang of DAO...

Q: What choices do you get from the intellisense dropdown?
A: What is the intellisense dropdown?

Nov 13 '05 #5

P: n/a
k wrote:
I guess I'm in over my head here, my db was working fine, but I wanted
to split it to easier make updates.
I seem not to be able to answer your questions...

Q: Are you sure you have a reference to DAO
A: I'm not sure, I don't know what you mean, and really never got the
hang of DAO...
If it was working before it must have been there, the method of data
access you're using is DAO.
Q: What choices do you get from the intellisense dropdown?
A: What is the intellisense dropdown?


When you type something like "db." in the code window you get a dropdown
list of methods and properties for the database object.

--
This sig left intentionally blank
Nov 13 '05 #6

P: n/a
k
> When you type something like "db." in the code window you get a
dropdown
list of methods and properties for the database object.

--
This sig left intentionally blank


Thanks for hanging in there with me...

The dropdown doesn't give me a .opendynaset but the openrecordset is
there.

I paste the whole code-piece here, what i does, or what it did before i
split my db, was to add a number of records to a many-to-many relation
table (tbl1), based on the selected items in a list.

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim varEvent As Variant
Dim ctlEvent As Control

Set ctlEvent = Me.List1
Set db = CurrentDb
Set rs = db.OpenRecordset("tbl1", dbOpenTable, dbAppendOnly)

For Each varEvent In ctlEvent.ItemsSelected
rs.AddNew
rs.Fields("field1") = Me.ID
rs.Fields("field2") = ctlEvent.ItemData(varEvent)
rs.Update
Next varEvent
rs.Close
Set rs = Nothing
Set db = Nothing
I guess the first to codelines is my reference to DAO...
K

Nov 13 '05 #7

P: n/a
k wrote:
When you type something like "db." in the code window you get a


dropdown
list of methods and properties for the database object.

--
This sig left intentionally blank

Thanks for hanging in there with me...

The dropdown doesn't give me a .opendynaset but the openrecordset is
there.


Set rs = db.OpenRecordset("tbl1", dbOpenDynaset, dbAppendOnly)
--
This sig left intentionally blank
Nov 13 '05 #8

P: n/a
k

Trevor Best wrote:

Set rs = db.OpenRecordset("tbl1", dbOpenDynaset, dbAppendOnly)
--
This sig left intentionally blank


Thank you Trevor!

K

Nov 13 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.