Printing current record from form, after closing form for calculations.

S

Shirly

First sorry for my poor English, this is not my native language.

I have the folowing problem,
On a form i can enter values for a specific product, on the form a
autonr field is present (IDnr)
I want to print a report from this product after calculations
- these are done in div querys & tablemake querys
- for the report aditional data must be recoverd & calculated.

The code wont run, he gives the following error.

Can not find field | in expresion..

I cant find where i'm going wrong.

? maby someone can help me out here ?

I have the folowing code now onder a buton on my form

Private Sub Next_Click()
On Error GoTo Next_Click_Err
'declare varible
Dim intID as Integer
'give value to varible
intID = [Forms]![result]![IDnr]
'close forms so querys can be executed
DoCmd.Close acForm, result, asSaveYes
'set warnings off
DoCmd.SetWarnings False
'execute querys
DoCmd.OpenQuery "query1"
' --- whole list with querys to run
DoCmd.OpenQuery "guery31"
'set warnings on
DoCmd.SetWarings True
'print specific report from product selected on begining
DoCmd.OpenReport "R_AC",acviewPreview, "", "& intID,acNormal
'reopen form
DoCmd.OpenForm [F0113_result], acNormal
Next_Click_Exit:
Exit Sub
Next_Click_Err:
MsgBox Error$
Resume Next_Click_Exit
End Sub

Kind Regards
Shirly
 
E

Erez Mor

hello shirly
i dont know if there are other problems cant be seen from the code you wrote
but this line doesnt look right:
DoCmd.OpenReport "R_AC",acviewPreview, "", "& intID,acNormal

it doesnt make any sense because the where clause is wrong.

give some more details please.
Erez.
 
S

Shirly

Hello Erez,

the where clause come's (so far i know !) from the line's
please corect me if i am wrong

'declare varible (create temp value field)
Dim intID as Integer

'give value to varible (fill temp value field with the current IDnr
from form [result]
intID = [Forms]![result]![IDnr]

These where enterd in my code, as i realized that actionquerys cant run
if forms are opened,
I had to close the form, but remember the currend open record (so i can
make a print from that record!)

the rest of the code works.

Kind regards
Shirly
 

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