Bill-
Here's the code on the command button:
Public Sub Command64_Click()
On Error GoTo ErrHandle
Dim strSQLONE As String
strSQLONE = "UPDATE tblPartItineraryCityTour " & _
"SET [HotelDistanceToCityCenter] = " & Me.Parent.HotelDistanceToCityCenter & ", " & _
"[HotelCategoryID] = " & Me.Parent.HotelCategoryID & ", " & _
"[HotelStarID] = " & Me.Parent.HotelStarID & _
" WHERE PartItineraryCityTourID = " & Me.PartItineraryCityTourID
CurrentDb.Execute strSQLONE, dbFailOnError
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQLTWO As String
Set db = CurrentDb
strSQLTWO = "DELETE * FROM tblPartItineraryCityTourRoom " & _
"WHERE PartItineraryCityTourID = " & Me.PartItineraryCityTourID
db.Execute strSQLTWO
Me.Refresh
strSQL = "INSERT INTO tblPartItineraryCityTourRoom ( RoomTypeID, NumberOfRooms, PartItineraryCityTourID ) " & _
"SELECT tblGroupBookingRoom.RoomTypeID, tblGroupBookingRoom.NumberOfRooms, " & _
Me.PartItineraryCityTourID & " AS PartItineraryCityTourID " & _
"FROM tblGroupBookingRoom " & _
"WHERE tblGroupBookingRoom.GroupBookingID = " & Me.Parent.GroupBookingID
CurrentDb.Execute strSQL, dbFailOnError
Me.Refresh
ErrExit:
Exit Sub
ErrHandle:
Resume ErrExit
End Sub
On Error GoTo ErrHandle
Dim strSQLONE As String
strSQLONE = "UPDATE tblPartItineraryCityTour " & _
"SET [HotelDistanceToCityCenter] = " & Me.Parent.HotelDistanceToCityCenter & ", " & _
"[HotelCategoryID] = " & Me.Parent.HotelCategoryID & ", " & _
"[HotelStarID] = " & Me.Parent.HotelStarID & _
" WHERE PartItineraryCityTourID = " & Me.PartItineraryCityTourID
CurrentDb.Execute strSQLONE, dbFailOnError
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQLTWO As String
Set db = CurrentDb
strSQLTWO = "DELETE * FROM tblPartItineraryCityTourRoom " & _
"WHERE PartItineraryCityTourID = " & Me.PartItineraryCityTourID
db.Execute strSQLTWO
Me.Refresh
strSQL = "INSERT INTO tblPartItineraryCityTourRoom ( RoomTypeID, NumberOfRooms, PartItineraryCityTourID ) " & _
"SELECT tblGroupBookingRoom.RoomTypeID, tblGroupBookingRoom.NumberOfRooms, " & _
Me.PartItineraryCityTourID & " AS PartItineraryCityTourID " & _
"FROM tblGroupBookingRoom " & _
"WHERE tblGroupBookingRoom.GroupBookingID = " & Me.Parent.GroupBookingID
CurrentDb.Execute strSQL, dbFailOnError
Me.Refresh
ErrExit:
Exit Sub
ErrHandle:
Resume ErrExit
End Sub
Best Regards,
Kevin
Date: 2016-04-08 23:08Subject: [MS_AccessPros] Re: After running this code, the form keeps blinking without stop.Kevin
I'm curious. That code seems like overkill. Can you explain what clicking the command button does?Regards,Bill Mosca, Founder - MS_Access_Professionalshttp://www.thatlldoit.comMicrosoft Office Access MVPhttps://mvp.microsoft.com/en-us/PublicProfile/35852?fullName=Bill%20%20MoscaMy nothing-to-do-with-Access bloghttp://wrmosca.wordpress.com
---In MS_Access_Professionals@yahoogroups.com, <zhaoliqingoffice@163.com> wrote :Dear All,My problem is solved. Thanks.I changed the "Me.Requery" into "Me.Refresh" in the Public command button.Best Regards,KevinDate: 2016-04-08 14:30Subject: [MS_AccessPros] After running this code, the form keeps blinking without stop.Dear All,After running this code, the form keeps blinking without stop. Please help.On Error GoTo ErrHandle
Dim rst As DAO.Recordset
Set rst = Me.subRoomUpdate.Form.Recordset
rst.MoveFirst
Do Until rst.EOF
Call Me.subRoomUpdate.Form.Command64_Click
rst.MoveNext
Loop
Set rst = Nothing
ErrExit:
Exit Sub
ErrHandle:
Resume ErrExitBest Regards,Kevin
__._,_.___
Posted by: "zhaoliqingoffice@163.com" <zhaoliqingoffice@163.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (5) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar