Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Between two values

Status
Not open for further replies.

primagic

IS-IT--Management
Jul 24, 2008
476
GB
I am trying to write some vba that will check if a value is between to fields, however the code below comes back with a compile error: expected then or goto after the between statement. I am using sql as a backend

Code:
If Forms!frmLeads!frmLeadsSubForm.Form!MortgageSize Is Between Forms!frmTest!Betwee" And Forms!frmTest!End Then
 
How are ya primagic . . .

Code:
[blue]If Forms!frmLeads!frmLeadsSubForm.Form!MortgageSize >= Forms!frmTest![purple][b]LoControlName[/b][/purple] AND _
   Forms!frmLeads!frmLeadsSubForm.Form!MortgageSize <= Forms!frmTest![purple][b]HiControlName[/b][/purple] Then[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thank you AceMan,

Works perfectly. Would the code be the same if I need to query between two times? Like Between 9.00AM and 12:00PM (Midday)

 
primagic said:
[blue]Would the code be the same if I need to query between two times? Like Between 9.00AM and 12:00PM (Midday)[/blue]
That depends on wether your time field is type
[ol][li]DateTime [blue]with[/blue] a date.[/li]
[li]DateTime [blue]without[/blue] a date.[/li]
[li][blue]Text/AlphaNumeric[/blue][/li][/ol]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top