Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

w2ksp4.exe, WwwxxXdbf, procmail "FROM_MAILER" patch, Use of assignment to $[ is deprecated at /usr/local/sbin/apxs line 86. , wwwxxx vim, mysql closing table and opening table, 800c5000, setgid operation not permitted, pciehp: acpi_pciehprm on IBM, WWWXXX.DBF

Links

XODOX
Impressum

#1: need help with inserting a set of records

Posted on 2008-04-13 18:33:11 by mvdave

Hello all & I hope I'm posting in the right place..

I need to load a temporary table with a range of sequential dates,
passing it a beginning and an end date from a criteria form.

I have created the form FrmMakeDayFile with 2 unbound fields
[txtDateFr] and [TxtDateTo]. I simply want to be able to click a
button and have a routine of some sort append records to the table
tblDates with field Ddate inserted starting from txtDateFr and adding
a new record for each date, ending at TxtdateTo. (This data gets used
in a local front-end and is then zapped... but that part's under
control - I just need to quickly seed values to the dayfile table....)

I must be having a vague day as something that shoudld so easy is
eluding me... Can anybody start me off please.

thankyou.
Dave

Report this message

#2: Re: need help with inserting a set of records

Posted on 2008-04-13 18:54:09 by Rick Brandt

mvdave wrote:
> Hello all & I hope I'm posting in the right place..
>
> I need to load a temporary table with a range of sequential dates,
> passing it a beginning and an end date from a criteria form.
>
> I have created the form FrmMakeDayFile with 2 unbound fields
> [txtDateFr] and [TxtDateTo]. I simply want to be able to click a
> button and have a routine of some sort append records to the table
> tblDates with field Ddate inserted starting from txtDateFr and adding
> a new record for each date, ending at TxtdateTo. (This data gets used
> in a local front-end and is then zapped... but that part's under
> control - I just need to quickly seed values to the dayfile table....)
>
> I must be having a vague day as something that shoudld so easy is
> eluding me... Can anybody start me off please.
>
> thankyou.
> Dave

Depends on what you already know how to do and what you don't. You need...

A VBA code procedure that opens an editable Recordset against your
destination table.

A Loop within that procedure.

Within the loop you create a date value one larger than the previous loop
iteration DateAdd() function being a good mechanism here.

Within that same loop you insert the generated date into your Recordset.

You start the loop with your start date and you stop the loop after you
have inserted the value matching your end date.

Which of the above do you already know how to do and which do you need help
with?

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com

Report this message

#3: Re: need help with inserting a set of records

Posted on 2008-04-13 19:09:44 by mvdave

On Apr 14, 2:54=A0am, "Rick Brandt" <rickbran...@hotmail.com> wrote:
> mvdave wrote:
> > Hello all & I hope I'm posting in the right place..
>
> > I need to load a temporary table with a range of sequential dates,
> > passing it a beginning and an end date from a criteria form.
>
> > I have created the form FrmMakeDayFile with 2 unbound fields
> > [txtDateFr] and [TxtDateTo]. I simply want to be able to click a
> > button and have a routine of some sort append records to the table
> > tblDates with field Ddate inserted starting from txtDateFr and adding
> > a new record for each date, ending at TxtdateTo. (This data gets used
> > in a local front-end and is then zapped... but that part's under
> > control - I just need to quickly seed values to the dayfile table....)
>
> > I must be having a vague day as something that shoudld so easy is
> > eluding me... =A0Can anybody start me off please.
>
> > thankyou.
> > Dave
>
> Depends on what you already know how to do and what you don't. =A0You need=
....
>
> A VBA code procedure that opens an editable Recordset against your
> destination table.
>
> A Loop within that procedure.
>
> Within the loop you create a date value one larger than the previous loop
> iteration DateAdd() function being a good mechanism here.
>
> Within that same loop you insert the generated date into your Recordset.
>
> You start the loop with your start date =A0and you stop the loop after you=

> have inserted the value matching your end date.
>
> Which of the above do you already know how to do and which do you need hel=
p
> with?
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt =A0 at =A0 Hunter =A0 dot =A0 com- Hide quoted text -
>
> - Show quoted text -

Thanks Rick... A programmer i ain't.. but here's where i got to with
it..which has elementrs of what you've advised. But it's not working..
I'm sure there's somthing simpler.

Dim sdate As Date
Dim edate As Date
Dim Ddate As Date

Dim rstDayfile As Recordset
Dim db As Database
Dim sqldates As String

Set db =3D CurrentDb()
sqldates =3D "select * from TblDates"
Set rstDayfile =3D db.OpenRecordset(sqldates, dbOpenDynaset)
sdate =3D Me.txtFromDate
edate =3D Me.txtToDate
Ddate =3D DMax("ddate", "tbldates")

With rstDayfile
Do Until Ddate > edate
Ddate =3D sdate
AddNew
!Ddate =3D sdate + 1
Update
Loop
End With

Report this message

#4: Re: need help with inserting a set of records

Posted on 2008-04-13 19:24:54 by Salad

mvdave wrote:

> Hello all & I hope I'm posting in the right place..
>
> I need to load a temporary table with a range of sequential dates,
> passing it a beginning and an end date from a criteria form.
>
> I have created the form FrmMakeDayFile with 2 unbound fields
> [txtDateFr] and [TxtDateTo]. I simply want to be able to click a
> button and have a routine of some sort append records to the table
> tblDates with field Ddate inserted starting from txtDateFr and adding
> a new record for each date, ending at TxtdateTo. (This data gets used
> in a local front-end and is then zapped... but that part's under
> control - I just need to quickly seed values to the dayfile table....)
>
> I must be having a vague day as something that shoudld so easy is
> eluding me... Can anybody start me off please.
>
> thankyou.
> Dave

I might have a command button to initiate the append. Air code
Dim datFor As date
Dim rst As Recordset
set rst = Currentdb.openrecordset("TableName",dbopendynaset)
It Not IsNull(Me.FromDate) And Not IsNull(Me.ToDate) then
For datFor = Me.FromDate to Me.ToDate
rst.Addnew
rst!TableDateField = datFor
rst.Update
Next
Endif

Soon is now
http://www.youtube.com/watch?v=K2NrIALcNOw

Report this message

#5: Re: need help with inserting a set of records

Posted on 2008-04-13 19:28:50 by Rick Brandt

mvdave wrote:
> On Apr 14, 2:54 am, "Rick Brandt" <rickbran...@hotmail.com> wrote:
>> mvdave wrote:
>>> Hello all & I hope I'm posting in the right place..
>>
>>> I need to load a temporary table with a range of sequential dates,
>>> passing it a beginning and an end date from a criteria form.
>>
>>> I have created the form FrmMakeDayFile with 2 unbound fields
>>> [txtDateFr] and [TxtDateTo]. I simply want to be able to click a
>>> button and have a routine of some sort append records to the table
>>> tblDates with field Ddate inserted starting from txtDateFr and
>>> adding a new record for each date, ending at TxtdateTo. (This data
>>> gets used in a local front-end and is then zapped... but that
>>> part's under control - I just need to quickly seed values to the
>>> dayfile table....)
>>
>>> I must be having a vague day as something that shoudld so easy is
>>> eluding me... Can anybody start me off please.
>>
>>> thankyou.
>>> Dave
>>
>> Depends on what you already know how to do and what you don't. You
>> need...
>>
>> A VBA code procedure that opens an editable Recordset against your
>> destination table.
>>
>> A Loop within that procedure.
>>
>> Within the loop you create a date value one larger than the previous
>> loop iteration DateAdd() function being a good mechanism here.
>>
>> Within that same loop you insert the generated date into your
>> Recordset.
>>
>> You start the loop with your start date and you stop the loop after
>> you have inserted the value matching your end date.
>>
>> Which of the above do you already know how to do and which do you
>> need help with?
>>
>> --
>> Rick Brandt, Microsoft Access MVP
>> Email (as appropriate) to...
>> RBrandt at Hunter dot com- Hide quoted text -
>>
>> - Show quoted text -
>
> Thanks Rick... A programmer i ain't.. but here's where i got to with
> it..which has elementrs of what you've advised. But it's not working..
> I'm sure there's somthing simpler.
>
> Dim sdate As Date
> Dim edate As Date
> Dim Ddate As Date
>
> Dim rstDayfile As Recordset
> Dim db As Database
> Dim sqldates As String
>
> Set db = CurrentDb()
> sqldates = "select * from TblDates"
> Set rstDayfile = db.OpenRecordset(sqldates, dbOpenDynaset)
> sdate = Me.txtFromDate
> edate = Me.txtToDate
> Ddate = DMax("ddate", "tbldates")
>
> With rstDayfile
> Do Until Ddate > edate
> Ddate = sdate
> AddNew
> !Ddate = sdate + 1
> Update
> Loop
> End With

Try...

Dim edate As Date
Dim NewDate As Date
Dim rstDayfile As Recordset
Dim db As Database
Dim sqldates As String

Set db = CurrentDb()
sqldates = "select * from TblDates"
Set rstDayfile = db.OpenRecordset(sqldates, dbOpenDynaset)
NewDate = Me.txtFromDate
edate = Me.txtToDate

With rstDayfile
Do Until NewDate > edate
.AddNew
!Ddate = NewDate
.Update
NewDate = DateAdd("d", 1, NewDate)
Loop
End With



--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com

Report this message

#6: Re: need help with inserting a set of records

Posted on 2008-04-13 19:41:33 by mvdave

On Apr 14, 3:24=A0am, Salad <o...@vinegar.com> wrote:
> mvdave wrote:
> > Hello all & I hope I'm posting in the right place..
>
> > I need to load a temporary table with a range of sequential dates,
> > passing it a beginning and an end date from a criteria form.
>
> > I have created the form FrmMakeDayFile with 2 unbound fields
> > [txtDateFr] and [TxtDateTo]. I simply want to be able to click a
> > button and have a routine of some sort append records to the table
> > tblDates with field Ddate inserted starting from txtDateFr and adding
> > a new record for each date, ending at TxtdateTo. (This data gets used
> > in a local front-end and is then zapped... but that part's under
> > control - I just need to quickly seed values to the dayfile table....)
>
> > I must be having a vague day as something that shoudld so easy is
> > eluding me... =A0Can anybody start me off please.
>
> > thankyou.
> > Dave
>
> I might have a command button to initiate the append. =A0Air code
> =A0 =A0 =A0 =A0 Dim datFor As date
> =A0 =A0 =A0 =A0 Dim rst As Recordset
> =A0 =A0 =A0 =A0 set rst =3D Currentdb.openrecordset("TableName",dbopendyna=
set)
> =A0 =A0 =A0 =A0 It Not IsNull(Me.FromDate) And Not IsNull(Me.ToDate) then
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 For datFor =3D Me.FromDate to Me.ToDate
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 rst.Addnew
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 rst!TableDateField =3D dat=
For
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 rst.Update
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Next
> =A0 =A0 =A0 =A0 Endif
>
> Soon is nowhttp://www.youtube.com/watch?v=3DK2NrIALcNOw- Hide quoted text =
-
>
> - Show quoted text -

OK - thankyou Salad!!

Here' the tidied version of your air code... Worked a treat! Thankyou
very much. It's 3:40 am here... time for some zzzzz's. Much
appreciated. Dave.

Private Sub CmdMakeDayFile_Click()

Dim datFor As Date
Dim rst As Recordset

Set rst =3D CurrentDb.OpenRecordset("tblDates", dbOpenDynaset)

If Not IsNull(Me.txtFromDate) And Not IsNull(Me.txtToDate) Then
For datFor =3D Me.txtFromDate To Me.txtToDate
rst.AddNew
rst!Ddate =3D datFor
rst.Update
Next
End If

End Sub

Report this message

#7: Re: need help with inserting a set of records

Posted on 2008-04-13 20:00:07 by fredg

On Sun, 13 Apr 2008 09:33:11 -0700 (PDT), mvdave wrote:

> Hello all & I hope I'm posting in the right place..
>
> I need to load a temporary table with a range of sequential dates,
> passing it a beginning and an end date from a criteria form.
>
> I have created the form FrmMakeDayFile with 2 unbound fields
> [txtDateFr] and [TxtDateTo]. I simply want to be able to click a
> button and have a routine of some sort append records to the table
> tblDates with field Ddate inserted starting from txtDateFr and adding
> a new record for each date, ending at TxtdateTo. (This data gets used
> in a local front-end and is then zapped... but that part's under
> control - I just need to quickly seed values to the dayfile table....)
>
> I must be having a vague day as something that shoudld so easy is
> eluding me... Can anybody start me off please.
>
> thankyou.
> Dave



Copy and paste the below code into a Module.
Open your form and enter the 2 dates.
Run the Code.

Public Sub FillDates()
' Will fill a Date Field with consecutive date values.

Dim db As DAO.Database
Dim rs As Recordset
Dim dteFrom As Date
Dim dteTo As Date
Set db = CurrentDb
Set rs = db.OpenRecordset("tblDates")
dteFrom = Forms!FrmMakeDayFile![txtDateFr]
dteTo = Forms!FrmMakeDayFile![txtDateTo]

With rs
Do Until dteFrom = dteTo + 1
.AddNew
!Ddate = dteFrom
.Update
dteFrom = dteFrom + 1
Loop
End With
Set db = Nothing
Set rs = Nothing
End Sub
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Report this message

#8: Re: need help with inserting a set of records

Posted on 2008-04-13 20:25:40 by Salad

mvdave wrote:

> On Apr 14, 3:24 am, Salad <o...@vinegar.com> wrote:
>
>>mvdave wrote:
>>
>>>Hello all & I hope I'm posting in the right place..
>>
>>>I need to load a temporary table with a range of sequential dates,
>>>passing it a beginning and an end date from a criteria form.
>>
>>>I have created the form FrmMakeDayFile with 2 unbound fields
>>>[txtDateFr] and [TxtDateTo]. I simply want to be able to click a
>>>button and have a routine of some sort append records to the table
>>>tblDates with field Ddate inserted starting from txtDateFr and adding
>>>a new record for each date, ending at TxtdateTo. (This data gets used
>>>in a local front-end and is then zapped... but that part's under
>>>control - I just need to quickly seed values to the dayfile table....)
>>
>>>I must be having a vague day as something that shoudld so easy is
>>>eluding me... Can anybody start me off please.
>>
>>>thankyou.
>>>Dave
>>
>>I might have a command button to initiate the append. Air code
>> Dim datFor As date
>> Dim rst As Recordset
>> set rst = Currentdb.openrecordset("TableName",dbopendynaset)
>> It Not IsNull(Me.FromDate) And Not IsNull(Me.ToDate) then
>> For datFor = Me.FromDate to Me.ToDate
>> rst.Addnew
>> rst!TableDateField = datFor
>> rst.Update
>> Next
>> Endif
>>
>>Soon is nowhttp://www.youtube.com/watch?v=K2NrIALcNOw- Hide quoted text -
>>
>>- Show quoted text -
>
>
> OK - thankyou Salad!!
>
> Here' the tidied version of your air code... Worked a treat! Thankyou
> very much. It's 3:40 am here... time for some zzzzz's. Much
> appreciated. Dave.

It appears you are a bit aways from the US. Australia?

I think you can either go to bed now or get up for the Monday commute.

>
> Private Sub CmdMakeDayFile_Click()
>
> Dim datFor As Date
> Dim rst As Recordset
>
> Set rst = CurrentDb.OpenRecordset("tblDates", dbOpenDynaset)
>
> If Not IsNull(Me.txtFromDate) And Not IsNull(Me.txtToDate) Then
> For datFor = Me.txtFromDate To Me.txtToDate
> rst.AddNew
> rst!Ddate = datFor
> rst.Update
> Next
> End If
>
> End Sub

Report this message

#9: Re: need help with inserting a set of records

Posted on 2008-04-13 23:48:11 by mvdave

On Apr 14, 4:25=A0am, Salad <o...@vinegar.com> wrote:
> mvdave wrote:
> > On Apr 14, 3:24 am, Salad <o...@vinegar.com> wrote:
>
> >>mvdave wrote:
>
> >>>Hello all & I hope I'm posting in the right place..
>
> >>>I need to load a temporary table with a range of sequential dates,
> >>>passing it a beginning and an end date from a criteria form.
>
> >>>I have created the form FrmMakeDayFile with 2 unbound fields
> >>>[txtDateFr] and [TxtDateTo]. I simply want to be able to click a
> >>>button and have a routine of some sort append records to the table
> >>>tblDates with field Ddate inserted starting from txtDateFr and adding
> >>>a new record for each date, ending at TxtdateTo. (This data gets used
> >>>in a local front-end and is then zapped... but that part's under
> >>>control - I just need to quickly seed values to the dayfile table....)
>
> >>>I must be having a vague day as something that shoudld so easy is
> >>>eluding me... =A0Can anybody start me off please.
>
> >>>thankyou.
> >>>Dave
>
> >>I might have a command button to initiate the append. =A0Air code
> >> =A0 =A0 =A0 =A0Dim datFor As date
> >> =A0 =A0 =A0 =A0Dim rst As Recordset
> >> =A0 =A0 =A0 =A0set rst =3D Currentdb.openrecordset("TableName",dbopendy=
naset)
> >> =A0 =A0 =A0 =A0It Not IsNull(Me.FromDate) And Not IsNull(Me.ToDate) the=
n
> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0For datFor =3D Me.FromDate to Me.ToDate
> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0rst.Addnew
> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0rst!TableDateField =3D d=
atFor
> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0rst.Update
> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Next
> >> =A0 =A0 =A0 =A0Endif
>
> >>Soon is nowhttp://www.youtube.com/watch?v=3DK2NrIALcNOw-Hide quoted text=
-
>
> >>- Show quoted text -
>
> > OK - thankyou Salad!!
>
> > Here' the tidied version of your air code... Worked a treat! Thankyou
> > very much. It's 3:40 am here... time for some zzzzz's. Much
> > appreciated. Dave.
>
> It appears you are a bit aways from the US. =A0Australia?
>
> I think you can either go to bed now or get up for the Monday commute.
>
>
>
>
>
> > Private Sub CmdMakeDayFile_Click()
>
> > Dim datFor As Date
> > Dim rst As Recordset
>
> > Set rst =3D CurrentDb.OpenRecordset("tblDates", dbOpenDynaset)
>
> > If Not IsNull(Me.txtFromDate) And Not IsNull(Me.txtToDate) Then
> > =A0 =A0 For datFor =3D Me.txtFromDate To Me.txtToDate
> > =A0 =A0 =A0 =A0 rst.AddNew
> > =A0 =A0 =A0 =A0 rst!Ddate =3D datFor
> > =A0 =A0 =A0 =A0 rst.Update
> > =A0 =A0 Next
> > End If
>
> > End Sub- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Yes, I'm in Sydney and thankyou to all for your quick and varied
suggestions. I've tried posting on other help forums before and gone
days without a response, so I really appreciate the way you've all
jumped in and helped.

Now.. I owe I owe... so off to work i go..

Dave

Report this message