Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Look Up Help (A2K Sp3)

    I have a frmCheckInLast that has the operator input a room number. It then calls up the last rental record for that customer. The operator verifies that the correct record was selected and then presses a new record button. This creates a new record and populated the majority of the fields based on the information on the last record using auto fill.

    If the PayPeriod (i.e. Duration) changes, the operator selects a new pay period from a ComboBox. The ComboBox, PayCodeID, has an After Update Event that look up the room rate as follows:

    Private Sub PayCodeID_AfterUpdate()
    If [PayCodeID] = 1 Then [NumberofDays] = 7
    If [PayCodeID] = 2 Then [NumberofDays] = DaysInMonth2([RentBegDate] + 1)
    If [PayCodeID] = 3 Then [NumberofDays] = 1
    If [PayCodeID] = 4 Then [NumberofDays] = 0
    If [PayCodeID] = 5 Then [NumberofDays] = 3

    If IsNull(Me.PayCodeID) Then
    Me.RackRate = Null
    Me.RoomRate = Null
    ElseIf Not IsNull(Me.RoomNumber) Then
    Me.RoomRate = DLookup("Rate", "tblRoomRates", "RoomTypeID = " & _
    Me.RoomTypeID & " AND PayCodeID = " & Me.PayCodeID)
    If Me.DoubleOccupancy Then
    Me.RoomRate = Me.RoomRate + Me.Extra
    ElseIf [PayCodeID] = 2 And [RoomRate] = 0 Then
    MonthlyErrorMsgForMiniRooms
    ElseIf [PayCodeID] = 5 And [RoomRate] = 0 Then
    BusinessErrorMsg
    End If
    Me.RackRate = Me.RoomRate


    End If

    End Sub

    The operator used to enter the RoomNumber and then select a room type from a combo Box, RoomTypeID. I recently have changed the form so when the room number is entered it automatically fills in the RoomType from tblRoomType. TblRoomTyoe has 2 fields RoomTypeID and RoomType.

    TblRoomRates has 3 fields: RoomTypeID, PayCodeID and Rate

    Since the RoomTypeID is no longer on the form, the look up fails. When I try to change the PayPeriod, I get a

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Look Up Help (A2K Sp3)

    Is RoomTypeID a field in tblRoom? If not, how is tblRoom related to tblRoomType?

  3. #3
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Look Up Help (A2K Sp3)

    RoomTypeIID is a field in tblRoomRates as well as in tbleRoomType, tblRoom, and tblRental.

    Tom

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Look Up Help (A2K Sp3)

    When you placed a text box bound to RoomTypeId on the form, did you give it the same name as the field, or does it have a generic name such as Text37?

  5. #5
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Look Up Help (A2K Sp3)

    Many thanks for your assistance. When I changed the name from a Generic name to RoomTypeID that solved the problem.

    Tom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •