A
Ange Kappas
Hi,
I have the below code which copies records from a query to a table
as below which works fine, but I want it in the last line where it copies:
MySet2![DAILY CHARGE] = MySet![Price]
if in the
Myset![PRICELIST] the value is "Z" to copy this instead
MySet2![DAILY CHARGE] = MySet![DAILY CHARGE]
otherwise to continue to copy
MySet2![DAILY CHARGE] = MySet![Price]
What do I have to modify below to make it work.
Thanks
Ange
Dim PoseidonHotelProgram As Database
Dim rsta As DAO.Recordset
Dim frm As Form
Dim Msg, Style, Title, Response, MyString
Set db1 = CurrentDb()
Set MySet = db1.OpenRecordset("TODAY CHARGES")
Set MySet2 = db1.OpenRecordset("RESPEL ALL CHARGES")
With MySet
If Not .EOF Then
.MoveFirst
End If
Do While Not .EOF
MySet2.AddNew
MySet2![Date] = MySet![Date]
MySet2![PELNMB] = MySet![PELNMB]
MySet2![RESNO] = MySet![RESNO]
MySet2![RESNAME] = MySet![RESNAME]
MySet2![COMPANY] = MySet![COMPANY]
MySet2![PRICELIST] = MySet![PRICELIST]
MySet2![HOTELAPT] = MySet![HOTELAPT]
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![SURNAME] = MySet![SURNAME]
MySet2![NAME] = MySet![NAME]
MySet2![DAILY CHARGE] = MySet![Price]
MySet2.Update
..MoveNext
Loop
End With
MySet2.Close
I have the below code which copies records from a query to a table
as below which works fine, but I want it in the last line where it copies:
MySet2![DAILY CHARGE] = MySet![Price]
if in the
Myset![PRICELIST] the value is "Z" to copy this instead
MySet2![DAILY CHARGE] = MySet![DAILY CHARGE]
otherwise to continue to copy
MySet2![DAILY CHARGE] = MySet![Price]
What do I have to modify below to make it work.
Thanks
Ange
Dim PoseidonHotelProgram As Database
Dim rsta As DAO.Recordset
Dim frm As Form
Dim Msg, Style, Title, Response, MyString
Set db1 = CurrentDb()
Set MySet = db1.OpenRecordset("TODAY CHARGES")
Set MySet2 = db1.OpenRecordset("RESPEL ALL CHARGES")
With MySet
If Not .EOF Then
.MoveFirst
End If
Do While Not .EOF
MySet2.AddNew
MySet2![Date] = MySet![Date]
MySet2![PELNMB] = MySet![PELNMB]
MySet2![RESNO] = MySet![RESNO]
MySet2![RESNAME] = MySet![RESNAME]
MySet2![COMPANY] = MySet![COMPANY]
MySet2![PRICELIST] = MySet![PRICELIST]
MySet2![HOTELAPT] = MySet![HOTELAPT]
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![SURNAME] = MySet![SURNAME]
MySet2![NAME] = MySet![NAME]
MySet2![DAILY CHARGE] = MySet![Price]
MySet2.Update
..MoveNext
Loop
End With
MySet2.Close