
November 13th, 2005, 08:18 AM
|
|
|
splitted database crashes when adding records to linked table
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
|

November 13th, 2005, 08:18 AM
|
|
|
Re: splitted database crashes when adding records to linked table
k wrote:[color=blue]
> Set rs = db.OpenRecordset("tblDeltakelse", dbOpenTable,
> dbAppendOnly)[/color]
Use dbOpenDynaset with linked tables.
--
--
Lyle
--
|

November 13th, 2005, 08:18 AM
|
|
|
Re: splitted database crashes when adding records to linked table
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
|

November 13th, 2005, 08:20 AM
|
|
|
Re: splitted database crashes when adding records to linked table
k wrote:[color=blue]
> 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
>[/color]
Are you sure you have a reference to DAO? What choices do you get from
the intellisense dropdown?
--
This sig left intentionally blank
|

November 13th, 2005, 08:21 AM
|
|
|
Re: splitted database crashes when adding records to linked table
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?
|

November 13th, 2005, 08:21 AM
|
|
|
Re: splitted database crashes when adding records to linked table
k wrote:[color=blue]
> 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...[/color]
If it was working before it must have been there, the method of data
access you're using is DAO.
[color=blue]
> Q: What choices do you get from the intellisense dropdown?
> A: What is the intellisense dropdown?
>[/color]
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
|

November 13th, 2005, 08:21 AM
|
|
|
Re: splitted database crashes when adding records to linked table
> When you type something like "db." in the code window you get a
dropdown[color=blue]
> list of methods and properties for the database object.
>
> --
> This sig left intentionally blank[/color]
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
|

November 13th, 2005, 08:21 AM
|
|
|
Re: splitted database crashes when adding records to linked table
k wrote:[color=blue][color=green]
>>When you type something like "db." in the code window you get a[/color]
>
> dropdown
>[color=green]
>>list of methods and properties for the database object.
>>
>>--
>>This sig left intentionally blank[/color]
>
>
> Thanks for hanging in there with me...
>
> The dropdown doesn't give me a .opendynaset but the openrecordset is
> there.[/color]
Set rs = db.OpenRecordset("tbl1", dbOpenDynaset, dbAppendOnly)
--
This sig left intentionally blank
|

November 13th, 2005, 08:23 AM
|
|
|
Re: splitted database crashes when adding records to linked table
Trevor Best wrote:[color=blue]
>
> Set rs = db.OpenRecordset("tbl1", dbOpenDynaset, dbAppendOnly)
>
>
> --
> This sig left intentionally blank[/color]
Thank you Trevor!
K
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over network members.
|