Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 13th, 2005, 11:41 AM
ChadDiesel
Guest
 
Posts: n/a
Default Print Report Based on Form

Hello,

I have a form and subform with their tables linked by a field called
Load_ID. I have a button on my subform that prints just the items listed on
that particular subform (looking at Load_ID). I'm using the following code:

DoCmd.OpenReport "Load Sheet", acPreview, , "[Load_ID]= " & "'" &
Me.Parent.Form![Load_ID] & "'"

This works fine, but now I want to automate the process, so I set the
Load_ID on the main form/table to be an AutoNumber field. I changed
subform/other table Load_ID to a number field (it was a text field), but I
get the following error when I press the print report button:

Run-time error '3464'

Data type mismatch in criteria expression.

I assume this is because my Load_ID is a number value instead of text. My
question is, how do I re-write the above command to get it to work with
number values? Any help would be appreciated.

Thanks,

Chad


  #2  
Old November 13th, 2005, 11:41 AM
Wolf
Guest
 
Posts: n/a
Default Re: Print Report Based on Form

Chad,
You don't need the quote marks around a number. Access thinks you are
trying to pass a string, even if it's all numbers.

DoCmd.OpenReport "Load Sheet", acPreview, , "[Load_ID]= " &
Me.Parent.Form![Load_ID]

should do the trick.

  #3  
Old November 13th, 2005, 11:41 AM
ChadDiesel
Guest
 
Posts: n/a
Default Re: Print Report Based on Form

That worked great. Thanks for the quick reponse. That solved my problem.

Thanks,

Chad


"Wolf" <spamcatcher5050@hotmail.com> wrote in message
news:1118271219.879425.276510@o13g2000cwo.googlegr oups.com...[color=blue]
> Chad,
> You don't need the quote marks around a number. Access thinks you are
> trying to pass a string, even if it's all numbers.
>
> DoCmd.OpenReport "Load Sheet", acPreview, , "[Load_ID]= " &
> Me.Parent.Form![Load_ID]
>
> should do the trick.
>[/color]


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles