If then statement

DavidAC

Board Regular
Joined
Feb 10, 2003
Messages
134
Office Version
  1. 365
hi,
i am struggling with getting a if then statement to work correctly. I have a DB which is set up as a many to many as it releates to vehicle hire with a start_date and end_date. what i need the system to do is to
  1. confirm hire end date is > hire start date
  2. hire start date for next customer of vehicle is > end date of previous customer
  3. end date must be populate before new start date can be entered

i currently have the code for the first bit but am struggling with the next bit any help appreciated.

Code:
Private Sub Date_Handed_Back_AfterUpdate()
If Me.Date_Handed_Back < Me.Start_Date Then     
         MsgBox "Please enter a date greater than or equal to Hire Start Date."
         Me.Date_Handed_Back.SetFocus         
    End If
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
sorry i am using a junction table and it is within this table that the start and end dates are held.
as i said it is the if statement's i am strugglnig with.
 
Upvote 0
How about posting your tables and relationships so it is clear what you are asking?
You said you had a many to many, now you say you have a junction table. I'm a bit confused, but willing to help.
 
Upvote 0

Forum statistics

Threads
1,224,605
Messages
6,179,860
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top