Blank fields (sometimes)

A

Amour

Hi I am new to Access/VBA. Anyway this is the problem I am having:

When I first type the information on a form (frmTravel) (without closing and
reopening). And I click on a print button (that is on the frmTravel) I get
(on ther report) no or some missing fields that are on the form. But when I
close that form and reopen it will display, if I go back to the form and
change anything it works fine and the changes show up on the report. Here is
the code behind the print button:

Me.Dirty = False
DoCmd.OpenReport "rptTravel", acViewPreview, , "[SSN] = '" & [SSN] & "'"

Thank You for any help..
 
A

Al Campagna

Amour,
Try a Refresh before the report runs. The data you just entered have not yet been
written to the table.
Refresh
Me.Dirty = False
DoCmd.OpenReport "rptTravel", acViewPreview, , "[SSN] = '" & [SSN] & "'"

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
A

Amour

That looks like it works but I am not sure just yet (remember sometimes the
fields display). Thank You much....

Al Campagna said:
Amour,
Try a Refresh before the report runs. The data you just entered have not yet been
written to the table.
Refresh
Me.Dirty = False
DoCmd.OpenReport "rptTravel", acViewPreview, , "[SSN] = '" & [SSN] & "'"

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Amour said:
Hi I am new to Access/VBA. Anyway this is the problem I am having:

When I first type the information on a form (frmTravel) (without closing and
reopening). And I click on a print button (that is on the frmTravel) I get
(on ther report) no or some missing fields that are on the form. But when I
close that form and reopen it will display, if I go back to the form and
change anything it works fine and the changes show up on the report. Here is
the code behind the print button:

Me.Dirty = False
DoCmd.OpenReport "rptTravel", acViewPreview, , "[SSN] = '" & [SSN] & "'"

Thank You for any help..
 

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