I have a MS Access database with:
. a table RoomList with 5 columns: RoomNum, Daily, Weekend, Holiday, Special
with 1 row has RoomNum values of 102
. a table AssignedList with 6 columns: RNum, RDaily, RWeekend, RHoliday, Special, GConf with 1 row has ordered values are 102 $50.00 $60.00 $70.00 $100.00 '12345'
*) Except the GConf equal String, the other fields are same types
- I want to copy those 4 rates from table AssignedList where GConf = '12345' to table RoomList from same Room 102
Here is my codes:
strSQL = "UPDATE RoomList SET "
strSQL = strSQL & "(RoomList.Daily = AssignedList.RDaily, RoomList.Weekend = AssignedList.RWeekend, "
strSQL = strSQL & "RoomList.Holiday = AssignedList.RHoliday, RoomList.Special = AssignedList.RSpecial) "
strSQL = strSQL & "FROM RoomList INNER JOIN AssignedList ON RoomList.RoomNum = AssignedList.RNum "
strSQL = strSQL & "AND AssignedList.GConf = '12345' "
cmdMSA = New OleDbCommand(strSQL, dbConn2)
Try
If Not (cmdMSA.ExecuteScalar() = Nothing) Then
f_Failed = True
End If
Catch ex As Exception
MessageBox.Show("Error Update RoomList from AssignedList = " & ex.Message)
End Try
cmdMSA.Dispose()
It has error: Syntax error (missing operator) in query expression 'AssignedList.RSpecial FROM RoomList INNER JOIN AssignedList ON RoomList.RoomNum = AssignedList.RNum'
Can someone correct the problem or if MS Access can't accept them, might we have other similiar codes?
. a table RoomList with 5 columns: RoomNum, Daily, Weekend, Holiday, Special
with 1 row has RoomNum values of 102
. a table AssignedList with 6 columns: RNum, RDaily, RWeekend, RHoliday, Special, GConf with 1 row has ordered values are 102 $50.00 $60.00 $70.00 $100.00 '12345'
*) Except the GConf equal String, the other fields are same types
- I want to copy those 4 rates from table AssignedList where GConf = '12345' to table RoomList from same Room 102
Here is my codes:
strSQL = "UPDATE RoomList SET "
strSQL = strSQL & "(RoomList.Daily = AssignedList.RDaily, RoomList.Weekend = AssignedList.RWeekend, "
strSQL = strSQL & "RoomList.Holiday = AssignedList.RHoliday, RoomList.Special = AssignedList.RSpecial) "
strSQL = strSQL & "FROM RoomList INNER JOIN AssignedList ON RoomList.RoomNum = AssignedList.RNum "
strSQL = strSQL & "AND AssignedList.GConf = '12345' "
cmdMSA = New OleDbCommand(strSQL, dbConn2)
Try
If Not (cmdMSA.ExecuteScalar() = Nothing) Then
f_Failed = True
End If
Catch ex As Exception
MessageBox.Show("Error Update RoomList from AssignedList = " & ex.Message)
End Try
cmdMSA.Dispose()
It has error: Syntax error (missing operator) in query expression 'AssignedList.RSpecial FROM RoomList INNER JOIN AssignedList ON RoomList.RoomNum = AssignedList.RNum'
Can someone correct the problem or if MS Access can't accept them, might we have other similiar codes?