can i add a record automatically

R

richard harris

Hi All,

i have a form which allows a user to select which documents they wish to
print for a client record.

what i would like to do is to have a table (tblDocsPrinted) to record the
date and the name of each document printed.

i could just assign a field to each document and have this autodate but the
same document may be printed more than once, so i would like to record this.

my suggested fields are

DocID
DocName
DocPrintDate
DocUser (will be collected from logged on user)

is there a way that access can auto populate the table for me with the
correct date.

thanks in advance

richard
 
A

Arvin Meyer [MVP]

If you use a button on a form to print the report, the code might look like
this (air code):

Sub MyButton_Click
Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = CurrentDB
Set rst = db.OpenRecordset("tblMyData", dbOpenDynaset)

With rst
.AddNew
!DocID Me.txtDocID
!DocName = "rptMyData"
!DocPrintDate = Now
!DocUser = CurrentUser()
.Update
End With
DoCmd.OpenReport "rptMyData", acNormal, , "[ID]=" & Me![txtID]
End Sub

Change the names for your own report/form/control names. Current user is a
function of Access security, to get the Windows users look at the following
code:

http://www.mvps.org/access/api/api0008.htm
 
R

richard harris

Thanks Arvin,

works great.

regards

richard

Arvin Meyer said:
If you use a button on a form to print the report, the code might look like
this (air code):

Sub MyButton_Click
Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = CurrentDB
Set rst = db.OpenRecordset("tblMyData", dbOpenDynaset)

With rst
.AddNew
!DocID Me.txtDocID
!DocName = "rptMyData"
!DocPrintDate = Now
!DocUser = CurrentUser()
.Update
End With
DoCmd.OpenReport "rptMyData", acNormal, , "[ID]=" & Me![txtID]
End Sub

Change the names for your own report/form/control names. Current user is a
function of Access security, to get the Windows users look at the following
code:

http://www.mvps.org/access/api/api0008.htm
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

richard harris said:
Hi All,

i have a form which allows a user to select which documents they wish to
print for a client record.

what i would like to do is to have a table (tblDocsPrinted) to record the
date and the name of each document printed.

i could just assign a field to each document and have this autodate but
the
same document may be printed more than once, so i would like to record
this.

my suggested fields are

DocID
DocName
DocPrintDate
DocUser (will be collected from logged on user)

is there a way that access can auto populate the table for me with the
correct date.

thanks in advance

richard
 
R

richard harris

Hi Arvin,

a further thought, is there a way to get the document saved to a file
progmatically and then have the list of docs that we have creayed here to be
a hyperlink or similiar to the document, so the doc can be opened within the
programme.

currently the document is saved using Save As and then navigated to the
particular file for the client. if we could do the above then there would be
no need to save the doc to a particular file as the would be recalled through
the programme for each client.

ps - some docs are created using word and other using Access reports - i can
convert all to word if need be.

kind regards

richard

Arvin Meyer said:
If you use a button on a form to print the report, the code might look like
this (air code):

Sub MyButton_Click
Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = CurrentDB
Set rst = db.OpenRecordset("tblMyData", dbOpenDynaset)

With rst
.AddNew
!DocID Me.txtDocID
!DocName = "rptMyData"
!DocPrintDate = Now
!DocUser = CurrentUser()
.Update
End With
DoCmd.OpenReport "rptMyData", acNormal, , "[ID]=" & Me![txtID]
End Sub

Change the names for your own report/form/control names. Current user is a
function of Access security, to get the Windows users look at the following
code:

http://www.mvps.org/access/api/api0008.htm
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

richard harris said:
Hi All,

i have a form which allows a user to select which documents they wish to
print for a client record.

what i would like to do is to have a table (tblDocsPrinted) to record the
date and the name of each document printed.

i could just assign a field to each document and have this autodate but
the
same document may be printed more than once, so i would like to record
this.

my suggested fields are

DocID
DocName
DocPrintDate
DocUser (will be collected from logged on user)

is there a way that access can auto populate the table for me with the
correct date.

thanks in advance

richard
 
A

Arvin Meyer [MVP]

For a demonstration of a similar technique to what you are describing, have
a look at my DocMgr demo database:

http://www.datastrat.com/Download/DocMgr_2K.zip
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

richard harris said:
Hi Arvin,

a further thought, is there a way to get the document saved to a file
progmatically and then have the list of docs that we have creayed here to
be
a hyperlink or similiar to the document, so the doc can be opened within
the
programme.

currently the document is saved using Save As and then navigated to the
particular file for the client. if we could do the above then there would
be
no need to save the doc to a particular file as the would be recalled
through
the programme for each client.

ps - some docs are created using word and other using Access reports - i
can
convert all to word if need be.

kind regards

richard

Arvin Meyer said:
If you use a button on a form to print the report, the code might look
like
this (air code):

Sub MyButton_Click
Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = CurrentDB
Set rst = db.OpenRecordset("tblMyData", dbOpenDynaset)

With rst
.AddNew
!DocID Me.txtDocID
!DocName = "rptMyData"
!DocPrintDate = Now
!DocUser = CurrentUser()
.Update
End With
DoCmd.OpenReport "rptMyData", acNormal, , "[ID]=" & Me![txtID]
End Sub

Change the names for your own report/form/control names. Current user is
a
function of Access security, to get the Windows users look at the
following
code:

http://www.mvps.org/access/api/api0008.htm
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

message
Hi All,

i have a form which allows a user to select which documents they wish
to
print for a client record.

what i would like to do is to have a table (tblDocsPrinted) to record
the
date and the name of each document printed.

i could just assign a field to each document and have this autodate but
the
same document may be printed more than once, so i would like to record
this.

my suggested fields are

DocID
DocName
DocPrintDate
DocUser (will be collected from logged on user)

is there a way that access can auto populate the table for me with the
correct date.

thanks in advance

richard
 
R

richard harris

hi Arvin,

thanks, ill have a look tonights.

cheers

richard

Arvin Meyer said:
For a demonstration of a similar technique to what you are describing, have
a look at my DocMgr demo database:

http://www.datastrat.com/Download/DocMgr_2K.zip
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

richard harris said:
Hi Arvin,

a further thought, is there a way to get the document saved to a file
progmatically and then have the list of docs that we have creayed here to
be
a hyperlink or similiar to the document, so the doc can be opened within
the
programme.

currently the document is saved using Save As and then navigated to the
particular file for the client. if we could do the above then there would
be
no need to save the doc to a particular file as the would be recalled
through
the programme for each client.

ps - some docs are created using word and other using Access reports - i
can
convert all to word if need be.

kind regards

richard

Arvin Meyer said:
If you use a button on a form to print the report, the code might look
like
this (air code):

Sub MyButton_Click
Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = CurrentDB
Set rst = db.OpenRecordset("tblMyData", dbOpenDynaset)

With rst
.AddNew
!DocID Me.txtDocID
!DocName = "rptMyData"
!DocPrintDate = Now
!DocUser = CurrentUser()
.Update
End With
DoCmd.OpenReport "rptMyData", acNormal, , "[ID]=" & Me![txtID]
End Sub

Change the names for your own report/form/control names. Current user is
a
function of Access security, to get the Windows users look at the
following
code:

http://www.mvps.org/access/api/api0008.htm
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

message
Hi All,

i have a form which allows a user to select which documents they wish
to
print for a client record.

what i would like to do is to have a table (tblDocsPrinted) to record
the
date and the name of each document printed.

i could just assign a field to each document and have this autodate but
the
same document may be printed more than once, so i would like to record
this.

my suggested fields are

DocID
DocName
DocPrintDate
DocUser (will be collected from logged on user)

is there a way that access can auto populate the table for me with the
correct date.

thanks in advance

richard
 
R

richard harris

Hi Arvin,

i have had a look at the programme which seems to solve the issue i am
having, i have a couple of questions i hope you cananswer.

would the users still save their documents to the individual client file and
then this programme would pick them up at whichpint they could be opened n
the future from inside the programme to negate the need to explore folders?

would there be a way of having your programme refer to a particular client
(maybe a sub folder field from within the main folder) i hope that makes
sense. my thinking here, is when a record is opened for a particular client
could your programme recognise that (maybe through a filtered query)
particular record and as such only show documents relating to that client.

or, would a new table need to be created for each client and then the table
list filtered to reflect the particular client so it only shows the relavent
records.

i hope this is all clear, i like what you have done and hope it can be
implemented

thanks

richard

Arvin Meyer said:
For a demonstration of a similar technique to what you are describing, have
a look at my DocMgr demo database:

http://www.datastrat.com/Download/DocMgr_2K.zip
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

richard harris said:
Hi Arvin,

a further thought, is there a way to get the document saved to a file
progmatically and then have the list of docs that we have creayed here to
be
a hyperlink or similiar to the document, so the doc can be opened within
the
programme.

currently the document is saved using Save As and then navigated to the
particular file for the client. if we could do the above then there would
be
no need to save the doc to a particular file as the would be recalled
through
the programme for each client.

ps - some docs are created using word and other using Access reports - i
can
convert all to word if need be.

kind regards

richard

Arvin Meyer said:
If you use a button on a form to print the report, the code might look
like
this (air code):

Sub MyButton_Click
Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = CurrentDB
Set rst = db.OpenRecordset("tblMyData", dbOpenDynaset)

With rst
.AddNew
!DocID Me.txtDocID
!DocName = "rptMyData"
!DocPrintDate = Now
!DocUser = CurrentUser()
.Update
End With
DoCmd.OpenReport "rptMyData", acNormal, , "[ID]=" & Me![txtID]
End Sub

Change the names for your own report/form/control names. Current user is
a
function of Access security, to get the Windows users look at the
following
code:

http://www.mvps.org/access/api/api0008.htm
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

message
Hi All,

i have a form which allows a user to select which documents they wish
to
print for a client record.

what i would like to do is to have a table (tblDocsPrinted) to record
the
date and the name of each document printed.

i could just assign a field to each document and have this autodate but
the
same document may be printed more than once, so i would like to record
this.

my suggested fields are

DocID
DocName
DocPrintDate
DocUser (will be collected from logged on user)

is there a way that access can auto populate the table for me with the
correct date.

thanks in advance

richard
 
A

Arvin Meyer [MVP]

The code would have to be altered. I'd drill down to the client folder and
import the entire table for each folder each time. Then I'd compare and add
the new ones. If you didn't have to match records because of a key, you
could just reimport them each time.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

richard harris said:
Hi Arvin,

i have had a look at the programme which seems to solve the issue i am
having, i have a couple of questions i hope you cananswer.

would the users still save their documents to the individual client file
and
then this programme would pick them up at whichpint they could be opened n
the future from inside the programme to negate the need to explore
folders?

would there be a way of having your programme refer to a particular client
(maybe a sub folder field from within the main folder) i hope that makes
sense. my thinking here, is when a record is opened for a particular
client
could your programme recognise that (maybe through a filtered query)
particular record and as such only show documents relating to that client.

or, would a new table need to be created for each client and then the
table
list filtered to reflect the particular client so it only shows the
relavent
records.

i hope this is all clear, i like what you have done and hope it can be
implemented

thanks

richard

Arvin Meyer said:
For a demonstration of a similar technique to what you are describing,
have
a look at my DocMgr demo database:

http://www.datastrat.com/Download/DocMgr_2K.zip
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

message
Hi Arvin,

a further thought, is there a way to get the document saved to a file
progmatically and then have the list of docs that we have creayed here
to
be
a hyperlink or similiar to the document, so the doc can be opened
within
the
programme.

currently the document is saved using Save As and then navigated to the
particular file for the client. if we could do the above then there
would
be
no need to save the doc to a particular file as the would be recalled
through
the programme for each client.

ps - some docs are created using word and other using Access reports -
i
can
convert all to word if need be.

kind regards

richard

:

If you use a button on a form to print the report, the code might look
like
this (air code):

Sub MyButton_Click
Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = CurrentDB
Set rst = db.OpenRecordset("tblMyData", dbOpenDynaset)

With rst
.AddNew
!DocID Me.txtDocID
!DocName = "rptMyData"
!DocPrintDate = Now
!DocUser = CurrentUser()
.Update
End With
DoCmd.OpenReport "rptMyData", acNormal, , "[ID]=" & Me![txtID]
End Sub

Change the names for your own report/form/control names. Current user
is
a
function of Access security, to get the Windows users look at the
following
code:

http://www.mvps.org/access/api/api0008.htm
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

message
Hi All,

i have a form which allows a user to select which documents they
wish
to
print for a client record.

what i would like to do is to have a table (tblDocsPrinted) to
record
the
date and the name of each document printed.

i could just assign a field to each document and have this autodate
but
the
same document may be printed more than once, so i would like to
record
this.

my suggested fields are

DocID
DocName
DocPrintDate
DocUser (will be collected from logged on user)

is there a way that access can auto populate the table for me with
the
correct date.

thanks in advance

richard
 

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