Thanks Bruce, that helped heaps.
Stupid question, having a blonde moment what is Me???
Ness
--
Vanessa Nuttall
Pavement Maintenance Technican
"BruceM via AccessMonster.com" wrote:
> The code you have written assumes a combo box Row Source of at least four
> columns, with numbers in the second, third, and fourth columns. The first
> column would be numbered Column(0), the second Column(1), etc. The combo box
> properties would have to allow for the correct number of columns in Column
> Count, where you would add the actual number of columns (i.e. it is not zero-
> based numbering on the property sheet). Use the Column Widths to show or
> hide columns.
>
> BTW, you have declared two variables, strPriority and strDueDate, that you do
> not use in the code; and you have what seems to be an undeclared variable:
> dteNeeded. On another point, it will be clearer when reading the code if you
> use different prefixes for different data types. For instance, strPriority
> would be a string (text), and datDueDate would be a date.
>
> You could have a two column Row Source query like this:
>
> 4 Weeks 4
> 8 Weeks 8
>
> The Column Count would be 2, and the Column Widths something like 1.5";0"
>
> The combo box (cboPriority) After Update event could be:
>
> Me.TextBoxName = DateAdd("ww",Me.cboPriority.Column(1),Date)
>
> If you want to use days or other time units (along with weeks) for DateAdd
> you could have this:
>
> 5 Days 5
> 4 Weeks 28
> 8 Weeks 56
>
> The After Update expression would be:
>
> Me.TextBoxName = DateAdd("d",Me.cboPriority.Column(1),Date)
>
> TextBoxName is an unbound text box in which you display the expression result.
>
>
> You could adjust the expression depending on whether it is days, weeks, or
> months, but that would involve some extra steps.
>
> A futher thought is that you could have this as the Row Source:
>
> 5 5 Days
> 28 4 Weeks
> 56 8 Weeks
>
> Column Widths 0";1.5:
> Column Count 2
> Bound Column 1
>
> If the value you need is in the bound column, no need to specify the column:
>
> Me.TextBoxName = DateAdd("d",Me.cboPriority,Date)
>
> You could also add the number to an unbound text box, and select the unit of
> time from a combo box. I won't get into details, but rather want to point
> out there are a lot of options, depending on your specific needs.
>
>
> Dalocky wrote:
> >Thanks Guys
> >
> >I have written the code as
> >
> >Private Sub_DueDate
> >Dim strPriority As String
> >Dim strDuedate As Date
> >dteNeeded = DateAdd("d", cboPriority.Column(1), Date)
> >dteNeeded = DateAdd("d", cboPriority.Column(2), Date)
> >dteNeeded = DateAdd("d", cboPriority.Column(3), Date)
> >
> >I know I am missing something. It has been a couple of years since I played
> >in Access with VB.
> >> I have a set of timeframes under a priority. How can I get the date to
> >> default when a priority is selected, eg Priority is 8 weeks, due date from
> >> today would be?????
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...dules/201004/1
>
> .
>