copy values to a report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello,
i'm having a problem to copy values to a report. to be more exactly, i have
one button and when i click i have this sub function:

Private Sub Bok_Click()
Dim a, b, c, d, f
Dim ma, mb, mc, md, mf

a = Me.[Tcodigo].Value
b = Me.[Tmedicamento].Value
c = Me.[Tstock].Value
d = Me.[Tpedido].Value
f = Me.[Tcedido].Value

ma = Report_listagemimpressão.relatoriocodigo = a
mb = Report_listagemimpressão.relatoriomedicamento
mc = Report_listagemimpressão.relatoriostk
md = Report_listagemimpressão.relatorioped
mf = Report_listagemimpressão.relatorioced

ma = a
mb = b
mc = c
md = d
mf = f

End sub

it goes to get the values of the form, but doesn't copy the values to the
report, it show a message error --> Can't find the fiel, control or property
i nmicrosoft office Access.
if you have other way to do this i will aprecciate too.
Any sugestions??
thanks
 
At least part of the problem you're having is because you're not explicitly
declaring the data types. For example, ma, mb, etc should be declared as
Controls, and the keyword Set needs to be used:

Dim ma As Control, mb As Control, mc As Control, md As Control, mf As
Control

Set ma = Report_listagemimpressão.relatoriocodigo
Set mb = Report_listagemimpressão.relatoriomedicamento
Set mc = Report_listagemimpressão.relatoriostk
Set md = Report_listagemimpressão.relatorioped
Set mf = Report_listagemimpressão.relatorioced


However, there's really no reason to use intermediary variables anyhow. See
whether this works:

Private Sub Bok_Click()

Report_listagemimpressão.relatoriocodigo = Me.[Tcodigo].Value
Report_listagemimpressão.relatoriomedicamento = Me.[Tmedicamento].Value
Report_listagemimpressão.relatoriostk = Me.[Tstock].Value
Report_listagemimpressão.relatorioped = Me.[Tpedido].Value
Report_listagemimpressão.relatorioced = Me.[Tcedido].Value

End sub
 
thank you, the errors disapear, but it don't copy the values of the fields to
the report, what can be??
any sugestion!!

"Douglas J Steele" escreveu:
At least part of the problem you're having is because you're not explicitly
declaring the data types. For example, ma, mb, etc should be declared as
Controls, and the keyword Set needs to be used:

Dim ma As Control, mb As Control, mc As Control, md As Control, mf As
Control

Set ma = Report_listagemimpressão.relatoriocodigo
Set mb = Report_listagemimpressão.relatoriomedicamento
Set mc = Report_listagemimpressão.relatoriostk
Set md = Report_listagemimpressão.relatorioped
Set mf = Report_listagemimpressão.relatorioced


However, there's really no reason to use intermediary variables anyhow. See
whether this works:

Private Sub Bok_Click()

Report_listagemimpressão.relatoriocodigo = Me.[Tcodigo].Value
Report_listagemimpressão.relatoriomedicamento = Me.[Tmedicamento].Value
Report_listagemimpressão.relatoriostk = Me.[Tstock].Value
Report_listagemimpressão.relatorioped = Me.[Tpedido].Value
Report_listagemimpressão.relatorioced = Me.[Tcedido].Value

End sub



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Bruno Coelho said:
hello,
i'm having a problem to copy values to a report. to be more exactly, i have
one button and when i click i have this sub function:

Private Sub Bok_Click()
Dim a, b, c, d, f
Dim ma, mb, mc, md, mf

a = Me.[Tcodigo].Value
b = Me.[Tmedicamento].Value
c = Me.[Tstock].Value
d = Me.[Tpedido].Value
f = Me.[Tcedido].Value

ma = Report_listagemimpressão.relatoriocodigo = a
mb = Report_listagemimpressão.relatoriomedicamento
mc = Report_listagemimpressão.relatoriostk
md = Report_listagemimpressão.relatorioped
mf = Report_listagemimpressão.relatorioced

ma = a
mb = b
mc = c
md = d
mf = f

End sub

it goes to get the values of the form, but doesn't copy the values to the
report, it show a message error --> Can't find the fiel, control or property
i nmicrosoft office Access.
if you have other way to do this i will aprecciate too.
Any sugestions??
thanks
 
Thinking about it more, you need to refer to the Reports collection:

Private Sub Bok_Click()

Reports!Report_listagemimpressão!relatoriocodigo = Me![Tcodigo].Value
Reports!Report_listagemimpressão!relatoriomedicamento =
Me![Tmedicamento].Value
Reports!Report_listagemimpressão!relatoriostk = Me![Tstock].Value
Reports!Report_listagemimpressão!relatorioped = Me![Tpedido].Value
Reports!Report_listagemimpressão!relatorioced = Me![Tcedido].Value

End sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Bruno Coelho said:
thank you, the errors disapear, but it don't copy the values of the fields
to
the report, what can be??
any sugestion!!

"Douglas J Steele" escreveu:
At least part of the problem you're having is because you're not
explicitly
declaring the data types. For example, ma, mb, etc should be declared as
Controls, and the keyword Set needs to be used:

Dim ma As Control, mb As Control, mc As Control, md As Control, mf As
Control

Set ma = Report_listagemimpressão.relatoriocodigo
Set mb = Report_listagemimpressão.relatoriomedicamento
Set mc = Report_listagemimpressão.relatoriostk
Set md = Report_listagemimpressão.relatorioped
Set mf = Report_listagemimpressão.relatorioced


However, there's really no reason to use intermediary variables anyhow.
See
whether this works:

Private Sub Bok_Click()

Report_listagemimpressão.relatoriocodigo = Me.[Tcodigo].Value
Report_listagemimpressão.relatoriomedicamento =
Me.[Tmedicamento].Value
Report_listagemimpressão.relatoriostk = Me.[Tstock].Value
Report_listagemimpressão.relatorioped = Me.[Tpedido].Value
Report_listagemimpressão.relatorioced = Me.[Tcedido].Value

End sub



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Bruno Coelho said:
hello,
i'm having a problem to copy values to a report. to be more exactly, i have
one button and when i click i have this sub function:

Private Sub Bok_Click()
Dim a, b, c, d, f
Dim ma, mb, mc, md, mf

a = Me.[Tcodigo].Value
b = Me.[Tmedicamento].Value
c = Me.[Tstock].Value
d = Me.[Tpedido].Value
f = Me.[Tcedido].Value

ma = Report_listagemimpressão.relatoriocodigo = a
mb = Report_listagemimpressão.relatoriomedicamento
mc = Report_listagemimpressão.relatoriostk
md = Report_listagemimpressão.relatorioped
mf = Report_listagemimpressão.relatorioced

ma = a
mb = b
mc = c
md = d
mf = f

End sub

it goes to get the values of the form, but doesn't copy the values to
the
report, it show a message error --> Can't find the fiel, control or property
i nmicrosoft office Access.
if you have other way to do this i will aprecciate too.
Any sugestions??
thanks
 
hello,
it stills appear one error with the code you gave me and mine too, it is the
same error. the error is that he can find the report
(report_listagemimpressão), the report is there but he can't find it.
any sugestion.
thanks.

"Douglas J. Steele" escreveu:
Thinking about it more, you need to refer to the Reports collection:

Private Sub Bok_Click()

Reports!Report_listagemimpressão!relatoriocodigo = Me![Tcodigo].Value
Reports!Report_listagemimpressão!relatoriomedicamento =
Me![Tmedicamento].Value
Reports!Report_listagemimpressão!relatoriostk = Me![Tstock].Value
Reports!Report_listagemimpressão!relatorioped = Me![Tpedido].Value
Reports!Report_listagemimpressão!relatorioced = Me![Tcedido].Value

End sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Bruno Coelho said:
thank you, the errors disapear, but it don't copy the values of the fields
to
the report, what can be??
any sugestion!!

"Douglas J Steele" escreveu:
At least part of the problem you're having is because you're not
explicitly
declaring the data types. For example, ma, mb, etc should be declared as
Controls, and the keyword Set needs to be used:

Dim ma As Control, mb As Control, mc As Control, md As Control, mf As
Control

Set ma = Report_listagemimpressão.relatoriocodigo
Set mb = Report_listagemimpressão.relatoriomedicamento
Set mc = Report_listagemimpressão.relatoriostk
Set md = Report_listagemimpressão.relatorioped
Set mf = Report_listagemimpressão.relatorioced


However, there's really no reason to use intermediary variables anyhow.
See
whether this works:

Private Sub Bok_Click()

Report_listagemimpressão.relatoriocodigo = Me.[Tcodigo].Value
Report_listagemimpressão.relatoriomedicamento =
Me.[Tmedicamento].Value
Report_listagemimpressão.relatoriostk = Me.[Tstock].Value
Report_listagemimpressão.relatorioped = Me.[Tpedido].Value
Report_listagemimpressão.relatorioced = Me.[Tcedido].Value

End sub



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


hello,
i'm having a problem to copy values to a report. to be more exactly, i
have
one button and when i click i have this sub function:

Private Sub Bok_Click()
Dim a, b, c, d, f
Dim ma, mb, mc, md, mf

a = Me.[Tcodigo].Value
b = Me.[Tmedicamento].Value
c = Me.[Tstock].Value
d = Me.[Tpedido].Value
f = Me.[Tcedido].Value

ma = Report_listagemimpressão.relatoriocodigo = a
mb = Report_listagemimpressão.relatoriomedicamento
mc = Report_listagemimpressão.relatoriostk
md = Report_listagemimpressão.relatorioped
mf = Report_listagemimpressão.relatorioced

ma = a
mb = b
mc = c
md = d
mf = f

End sub

it goes to get the values of the form, but doesn't copy the values to
the
report, it show a message error --> Can't find the fiel, control or
property
i nmicrosoft office Access.
if you have other way to do this i will aprecciate too.
Any sugestions??
thanks
 
Is the report open when you're running the code? (It must be.)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Bruno Coelho said:
hello,
it stills appear one error with the code you gave me and mine too, it is the
same error. the error is that he can find the report
(report_listagemimpressão), the report is there but he can't find it.
any sugestion.
thanks.

"Douglas J. Steele" escreveu:
Thinking about it more, you need to refer to the Reports collection:

Private Sub Bok_Click()

Reports!Report_listagemimpressão!relatoriocodigo = Me![Tcodigo].Value
Reports!Report_listagemimpressão!relatoriomedicamento =
Me![Tmedicamento].Value
Reports!Report_listagemimpressão!relatoriostk = Me![Tstock].Value
Reports!Report_listagemimpressão!relatorioped = Me![Tpedido].Value
Reports!Report_listagemimpressão!relatorioced = Me![Tcedido].Value

End sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Bruno Coelho said:
thank you, the errors disapear, but it don't copy the values of the fields
to
the report, what can be??
any sugestion!!

"Douglas J Steele" escreveu:

At least part of the problem you're having is because you're not
explicitly
declaring the data types. For example, ma, mb, etc should be declared as
Controls, and the keyword Set needs to be used:

Dim ma As Control, mb As Control, mc As Control, md As Control, mf As
Control

Set ma = Report_listagemimpressão.relatoriocodigo
Set mb = Report_listagemimpressão.relatoriomedicamento
Set mc = Report_listagemimpressão.relatoriostk
Set md = Report_listagemimpressão.relatorioped
Set mf = Report_listagemimpressão.relatorioced


However, there's really no reason to use intermediary variables anyhow.
See
whether this works:

Private Sub Bok_Click()

Report_listagemimpressão.relatoriocodigo = Me.[Tcodigo].Value
Report_listagemimpressão.relatoriomedicamento =
Me.[Tmedicamento].Value
Report_listagemimpressão.relatoriostk = Me.[Tstock].Value
Report_listagemimpressão.relatorioped = Me.[Tpedido].Value
Report_listagemimpressão.relatorioced = Me.[Tcedido].Value

End sub



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


hello,
i'm having a problem to copy values to a report. to be more exactly, i
have
one button and when i click i have this sub function:

Private Sub Bok_Click()
Dim a, b, c, d, f
Dim ma, mb, mc, md, mf

a = Me.[Tcodigo].Value
b = Me.[Tmedicamento].Value
c = Me.[Tstock].Value
d = Me.[Tpedido].Value
f = Me.[Tcedido].Value

ma = Report_listagemimpressão.relatoriocodigo = a
mb = Report_listagemimpressão.relatoriomedicamento
mc = Report_listagemimpressão.relatoriostk
md = Report_listagemimpressão.relatorioped
mf = Report_listagemimpressão.relatorioced

ma = a
mb = b
mc = c
md = d
mf = f

End sub

it goes to get the values of the form, but doesn't copy the values to
the
report, it show a message error --> Can't find the fiel, control or
property
i nmicrosoft office Access.
if you have other way to do this i will aprecciate too.
Any sugestions??
thanks
 
yes, i tried with the report openned, and show tha same error.
what it can be??
thanks

"Douglas J Steele" escreveu:
Is the report open when you're running the code? (It must be.)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Bruno Coelho said:
hello,
it stills appear one error with the code you gave me and mine too, it is the
same error. the error is that he can find the report
(report_listagemimpressão), the report is there but he can't find it.
any sugestion.
thanks.

"Douglas J. Steele" escreveu:
Thinking about it more, you need to refer to the Reports collection:

Private Sub Bok_Click()

Reports!Report_listagemimpressão!relatoriocodigo = Me![Tcodigo].Value
Reports!Report_listagemimpressão!relatoriomedicamento =
Me![Tmedicamento].Value
Reports!Report_listagemimpressão!relatoriostk = Me![Tstock].Value
Reports!Report_listagemimpressão!relatorioped = Me![Tpedido].Value
Reports!Report_listagemimpressão!relatorioced = Me![Tcedido].Value

End sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



thank you, the errors disapear, but it don't copy the values of the fields
to
the report, what can be??
any sugestion!!

"Douglas J Steele" escreveu:

At least part of the problem you're having is because you're not
explicitly
declaring the data types. For example, ma, mb, etc should be declared as
Controls, and the keyword Set needs to be used:

Dim ma As Control, mb As Control, mc As Control, md As Control, mf As
Control

Set ma = Report_listagemimpressão.relatoriocodigo
Set mb = Report_listagemimpressão.relatoriomedicamento
Set mc = Report_listagemimpressão.relatoriostk
Set md = Report_listagemimpressão.relatorioped
Set mf = Report_listagemimpressão.relatorioced


However, there's really no reason to use intermediary variables anyhow.
See
whether this works:

Private Sub Bok_Click()

Report_listagemimpressão.relatoriocodigo = Me.[Tcodigo].Value
Report_listagemimpressão.relatoriomedicamento =
Me.[Tmedicamento].Value
Report_listagemimpressão.relatoriostk = Me.[Tstock].Value
Report_listagemimpressão.relatorioped = Me.[Tpedido].Value
Report_listagemimpressão.relatorioced = Me.[Tcedido].Value

End sub



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


hello,
i'm having a problem to copy values to a report. to be more exactly, i
have
one button and when i click i have this sub function:

Private Sub Bok_Click()
Dim a, b, c, d, f
Dim ma, mb, mc, md, mf

a = Me.[Tcodigo].Value
b = Me.[Tmedicamento].Value
c = Me.[Tstock].Value
d = Me.[Tpedido].Value
f = Me.[Tcedido].Value

ma = Report_listagemimpressão.relatoriocodigo = a
mb = Report_listagemimpressão.relatoriomedicamento
mc = Report_listagemimpressão.relatoriostk
md = Report_listagemimpressão.relatorioped
mf = Report_listagemimpressão.relatorioced

ma = a
mb = b
mc = c
md = d
mf = f

End sub

it goes to get the values of the form, but doesn't copy the values to
the
report, it show a message error --> Can't find the fiel, control or
property
i nmicrosoft office Access.
if you have other way to do this i will aprecciate too.
Any sugestions??
thanks
 
I'm running out of ideas!

Where is this code running: in the Form, or in the Report?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Bruno Coelho said:
yes, i tried with the report openned, and show tha same error.
what it can be??
thanks

"Douglas J Steele" escreveu:
Is the report open when you're running the code? (It must be.)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Bruno Coelho said:
hello,
it stills appear one error with the code you gave me and mine too, it
is
the
same error. the error is that he can find the report
(report_listagemimpressão), the report is there but he can't find it.
any sugestion.
thanks.

"Douglas J. Steele" escreveu:

Thinking about it more, you need to refer to the Reports collection:

Private Sub Bok_Click()

Reports!Report_listagemimpressão!relatoriocodigo = Me![Tcodigo].Value
Reports!Report_listagemimpressão!relatoriomedicamento =
Me![Tmedicamento].Value
Reports!Report_listagemimpressão!relatoriostk = Me![Tstock].Value
Reports!Report_listagemimpressão!relatorioped = Me![Tpedido].Value
Reports!Report_listagemimpressão!relatorioced = Me![Tcedido].Value

End sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



thank you, the errors disapear, but it don't copy the values of
the
fields
to
the report, what can be??
any sugestion!!

"Douglas J Steele" escreveu:

At least part of the problem you're having is because you're not
explicitly
declaring the data types. For example, ma, mb, etc should be
declared
as
Controls, and the keyword Set needs to be used:

Dim ma As Control, mb As Control, mc As Control, md As Control, mf As
Control

Set ma = Report_listagemimpressão.relatoriocodigo
Set mb = Report_listagemimpressão.relatoriomedicamento
Set mc = Report_listagemimpressão.relatoriostk
Set md = Report_listagemimpressão.relatorioped
Set mf = Report_listagemimpressão.relatorioced


However, there's really no reason to use intermediary variables anyhow.
See
whether this works:

Private Sub Bok_Click()

Report_listagemimpressão.relatoriocodigo = Me.[Tcodigo].Value
Report_listagemimpressão.relatoriomedicamento =
Me.[Tmedicamento].Value
Report_listagemimpressão.relatoriostk = Me.[Tstock].Value
Report_listagemimpressão.relatorioped = Me.[Tpedido].Value
Report_listagemimpressão.relatorioced = Me.[Tcedido].Value

End sub



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


hello,
i'm having a problem to copy values to a report. to be more exactly, i
have
one button and when i click i have this sub function:

Private Sub Bok_Click()
Dim a, b, c, d, f
Dim ma, mb, mc, md, mf

a = Me.[Tcodigo].Value
b = Me.[Tmedicamento].Value
c = Me.[Tstock].Value
d = Me.[Tpedido].Value
f = Me.[Tcedido].Value

ma = Report_listagemimpressão.relatoriocodigo = a
mb = Report_listagemimpressão.relatoriomedicamento
mc = Report_listagemimpressão.relatoriostk
md = Report_listagemimpressão.relatorioped
mf = Report_listagemimpressão.relatorioced

ma = a
mb = b
mc = c
md = d
mf = f

End sub

it goes to get the values of the form, but doesn't copy the
values
to
the
report, it show a message error --> Can't find the fiel, control or
property
i nmicrosoft office Access.
if you have other way to do this i will aprecciate too.
Any sugestions??
thanks
 
Back
Top