Combo select future dates only

G

Guest

Maybe this is not possible but ya never know.

I'm creating a form with very little space (it's for a shop counter
operation - so the screen is "very" small - about 20cm sq). With this mind I
need to keep the number of controls displayed to a minimum.

So - Combo. I'm using a very simple combo with 3 fields - ID, PurchaseOrder
and date fields to create new records. Is it possible to have the combo
display data from a pervious date but only allow new records with a future
date?

I have tried creating a standard query with future date criteria as the
control source but this means the combo will not display past purchase orders
and if I simply omit the criteria then most of the purchase orders will be
from past dates and so will not be bookable (and it would look daft).

Any ideas would be really helpful in either vba or just a starting point
description as I'm going mad with this.

Cheers all
 
J

John Vinson

Maybe this is not possible but ya never know.

I'm creating a form with very little space (it's for a shop counter
operation - so the screen is "very" small - about 20cm sq). With this mind I
need to keep the number of controls displayed to a minimum.

So - Combo. I'm using a very simple combo with 3 fields - ID, PurchaseOrder
and date fields to create new records. Is it possible to have the combo
display data from a pervious date but only allow new records with a future
date?

I have tried creating a standard query with future date criteria as the
control source but this means the combo will not display past purchase orders
and if I simply omit the criteria then most of the purchase orders will be
from past dates and so will not be bookable (and it would look daft).

Any ideas would be really helpful in either vba or just a starting point
description as I'm going mad with this.

Cheers all

I'm perplexed. Combos don't "create new records". They let you select
a value (from the combo's RowSource) and put that value into a single
field in a new (or existing) record; but a combo box by itself does
not create a new record!

What's the combo's Bound Column, and its Control Source? What field
are you trying to update using the combo? Might you not instead better
have a textbox for the date, with a DefaultValue property of Date()?
If you want to constrain that textbox to only today's and future
dates, you can use code in its BeforeUpdate event:

Private Sub txtSaleDate_BeforeUpdate(Cancel as Integer)
If Not IsDate(Me!txtSaleDate) Then
MsgBox "Please enter a valid date", vbOKOnly
Cancel = True
Exit Sub
End If
If Me!txtSaleDate < Date() Then
MsgBox "You can only enter sales today or in the future", vbOKOnly
Cancel = True
Exit Sub
End If
End Sub

John W. Vinson[MVP]
 
G

Guest

Hi John

Pesaroso para não explicando direito – sua resposta apontou-me na direção
correta tantos agradece para isso. O básico (principal e único) problema
grande com este projeto é a falta pura de espaço para qualquer controles na
forma. Combinei muitas ação "normal" tal como procura cria etc (usando o não
em lista) e uma carga de outro vba isso "tipo de" trabalhos no momento.
Muitos agradece para seu tempo e habilidade como sempre

--
Wayne
Manchester, England.
Enjoy whatever it is you do
 
G

Guest

ooops sorry should have been - - - - -

Hi John

Sorry for not explaining it right – your answer has pointed me in the right
direction so many thanks for that.

The basic (main and only) big problem with this project is the pure lack of
space for any controls on the form. I have combined many “normal†action
such as search create etc (using the not in list) and a load of other vba
that “sort of†works at the moment. (but it will do soon - so I keep telling
myself)

Many thanks for your time and skill as always

--
Wayne
Manchester, England.
Enjoy whatever it is you do
 
J

John Vinson

The basic (main and only) big problem with this project is the pure lack of
space for any controls on the form.

Would layering the controls using a Tab Page help?

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top