Re: Problem with Code Because I already have an Open Query
- From: "Ange Kappas" <angekap@xxxxxx>
- Date: Thu, 7 Feb 2008 21:52:28 +0200
Thanks John,
But I still get an error on the line:
Set MySet = CurrentDb.OpenRecordset("ACCOUNTS")
because the query ACCOUNTS is open due to filter from a form.
Ange
"J_Goddard via AccessMonster.com" <u37558@uwe> wrote in message
news:7f630c5cacbf6@xxxxxx
Hi -
By 'stuck', do you mean runtime or compile error?
You need
Dim MySet as DAO.recordset, myset2 as DAO.recordset
and then
'
' Queries are opened into recordsets just as tables are
'
Set Myset = CurrentDb.openrecordset("ACCOUNTS")
Set Myset2 = db1.OpenRecordset("ACCOUNTS CHARGED")
I assume that db1 is another database that you have established a link to?
The code looks fine otherwise.
John
Ange Kappas wrote:
Hi,
I have already open a Query named ACCOUNTS and I want to copy the
already filtered results into a Table name ACCOUNTS CHARGED.
The code is stuck on the Set Myset=CurrentDb("ACCOUNTS")
What do I have to adjust to make it work?
Thanks
Private Sub ACCOUNTS_CHARGE_Click()
Dim PoseidonHotelProgram As Database
Dim rsta As DAO.Recordset
Dim frm As Form
Dim Msg, Style, Title, Response, MyString
Set Myset = CurrentDb("ACCOUNTS")
Set Myset2 = db1.OpenRecordset("ACCOUNTS CHARGED")
With Myset
If Not .EOF Then
.MoveFirst
End If
Do While Not .EOF
Myset2.AddNew
Myset2![Date] = Myset![Date]
Myset2![RESNO] = Myset![RESNO]
Myset2![RESNAME] = Myset![RESNAME]
Myset2![COMPANY] = Myset![COMPANY]
Myset2![ROOMNO] = Myset![ROOMNO]
Myset2![ROOMTYPE] = Myset![ROOMTYPE]
Myset2![BASIS] = Myset![BASIS]
Myset2![ARRIVAL] = Myset![ARRIVAL]
Myset2![DAYS] = Myset![DAYS]
Myset2![DEPARTURE] = Myset![DEPARTURE]
Myset2![DAILY CHARGE] = Myset![DAILYRATE]
Myset2.Update
.MoveNext
Loop
End With
Myset2.Close
End Sub
--
John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca
Message posted via http://www.accessmonster.com
.
- Follow-Ups:
- Re: Problem with Code Because I already have an Open Query
- From: Jeanette Cunningham
- Re: Problem with Code Because I already have an Open Query
- From: J_Goddard via AccessMonster.com
- Re: Problem with Code Because I already have an Open Query
- References:
- Problem with Code Because I already have an Open Query
- From: Ange Kappas
- Re: Problem with Code Because I already have an Open Query
- From: J_Goddard via AccessMonster.com
- Problem with Code Because I already have an Open Query
- Prev by Date: Re: Show Record from SubForm on a new window
- Next by Date: Re: faxing?
- Previous by thread: Re: Problem with Code Because I already have an Open Query
- Next by thread: Re: Problem with Code Because I already have an Open Query
- Index(es):
Relevant Pages
|