Results 1 to 2 of 2
  1. #1
    harrie is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2016
    Posts
    8

    pls hlp me fix this bad coding

    2 forms , Rental_F and Car_F .
    Rental_F is a form for user to key in values,
    Car_F has Fixed values.

    i need to compare the ID in Rental_F and ID in Car_F
    If the ID match, then check the status in Car_F , if Available then the Rental_F save the record, else return a message.

    i have bad coding T...T
    Pls hlp me to fixed this coding.

    Save button named addRental, [Event Procedure]


    Private Sub addRental_Click()


    DoCmd.OpenForm "Rental_F"
    DoCmd.OpenForm "Car_F"


    IIF (Forms![Car_F]![txtID]=Forms![Rental_F]![ID])And
    (Forms![Car_F]![txtstatus]="Available")Then
    DoCmd.RunCommand acCmdSaveRecord
    Else
    MsgBox "This Car Is Currently Not Available", vbInformation, "Error"
    End If
    End Sub

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    in the rental form, you should have a combo box of cars available using a query.
    this way only available cars can be picked, so you can never pick a rented car.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. VBA Coding Help please
    By cfobare79 in forum Programming
    Replies: 6
    Last Post: 12-07-2014, 07:54 PM
  2. help with coding please
    By alexandervj in forum Access
    Replies: 2
    Last Post: 02-11-2014, 02:45 PM
  3. Coding within ADO
    By crowegreg in forum Programming
    Replies: 4
    Last Post: 08-20-2013, 01:34 PM
  4. Need help in VBA coding
    By Kcgp in forum Programming
    Replies: 6
    Last Post: 02-01-2012, 11:22 PM
  5. Bar-Coding
    By texasprincess7 in forum Access
    Replies: 1
    Last Post: 02-12-2009, 10:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums