PDA

View Full Version : Dates



wiganbhoy
11-28-2008, 05:52 AM
I need to have a field which has a drop down box with Urgen, Imediate and Routine. This in turn needs to auto populate a field called respond by with the date being current, 3 days from current and 7 days from current . Can this be done without code as complete newbie or any help would be great.

Ta:thumb

CreganTur
11-28-2008, 07:53 PM
Welcome to the forum- it's always good to see new members!


Can this be done without code as complete newbie or any help would be great.
Nope, this will require some VBA, but it's the perfect opportunity for you to learn!

Now, you'll need to create 2 objects on your form, specific to this issue: a combobox- set the properties to Items in List and create a list by hand with the values Urgent, Immediate, and Routine.

The second object is a textbox.

You'll need to give each of these items a unique name- using the default names is bad practice and can cause problems: for this example the combobox's name is cboStatus, and the textbox is txtDate.

Now, go back to your combobox's property sheet. On the Event Tab, click on the AfterUpdate property and click on the build button (...); if a popup appears select Code Window.

Here's the soce you would use:
If cboStatus = "Urgent" Then
txtDate = Date()
ElseIf cboStatus = "Immediate" Then
txtDate = Date + 3
ElseIf cboStatus = "Routine" Then
txtDate = Date + 7
End If

HTH:thumb

wiganbhoy
12-02-2008, 02:06 AM
:beerchug: Thanks I'm only in office few hours today but will do this tomorrow and reply. Many thanks for the trouble you went to.

KTF
Wiganbhoy

wiganbhoy
12-02-2008, 02:57 AM
I have a message from start in my respond box "#Name?" am I doing something wrong?

CreganTur
12-02-2008, 06:02 AM
Is your "respond box" the combobox or the textbox?

Check the row source; make sure it's setup correctly.

If you can't figure out the issue please post an example database that shows this form so I can see exatly what's going on.

wiganbhoy
12-03-2008, 01:19 AM
sorry for sounding daft but how do I post the database onto site?

wiganbhoy
12-03-2008, 01:20 AM
sorry for sounding daft but how do I post the database onto site?

wiganbhoy
12-03-2008, 01:20 AM
sorry for sounding daft but how do I post the database onto site?

wiganbhoy
12-03-2008, 01:22 AM
Ignore last message got it working many thx mate I owe you a pint

:thumb

wiganbhoy
12-16-2008, 02:36 AM
Ok all works fine but the Date recieved now changes to the same as the new repond date when it should remain the same as entered in

Thx
Tom

CreganTur
12-16-2008, 06:14 AM
Take a close look at your code- do you have anything that changes the value of the textbox that holds your date received? If so, then that would change the table.

Other than that I can't offer any help without seeing the code.

wiganbhoy
12-17-2008, 01:00 AM
can I email you with what I have?

CreganTur
12-17-2008, 06:14 AM
can I email you with what I have?

Please post the code here on the forum, or upload a copy of your database that doesn't show any private information. That way everyone who helps here has the opportunity to help solve this.