Forms :: Form Not Printing Correct Record?
Nov 7, 2014After data is entered and exit and print is selected, it doesnt print last record in the table
View RepliesAfter data is entered and exit and print is selected, it doesnt print last record in the table
View RepliesIn the following code to add an article to a purchase order line table and then open the form on the purchase order in question , I had to open the window "frmPurchase" twice in succession. If I omit the first docmd.openform statement, the form would open at the first record in the table, not the one defined in the where clause "PUOpen and PUCompID = " & Me.lstCompany.
I had noticed previously that, when the form "frmPurchase" was already open, Access went to the correct record, and not if the calling program had to open the window, which is why I came up with the idea of replicating this behavior in the code.
With rstC
.FindLast "PULineNB <> 0 AND PuLineHeadingID = " & rstB!PUID
If Not .NoMatch Then
linenb = rstC!PULineNb
Else
linenb = 0
[Code] ...
Is this normal behavior, and if not, how can I improve the code?
So I created a form for the nursery at my church. It's set up so that they pick their child from a drop down menu (in a separate form), then a form opens up that brings up their child's information. I have a save and print button at the bottom, and I was able to set it up so that it does save the form and close it, but I can't figure out how to get it to print. I need to set it up so that the information displayed is all that is printed (not all the records like it keeps showing in print preview), and print it at a certain size (like a label). Everything I keep finding says to print from a report, but I have it set up as a form.
View 1 Replies View RelatedI have made a navigation form that prints the current record out as a PDF and also the option to send the current record by email as a PDF. Both work perfect when you open the form outside the navigation form. But when you open it inside the navigation form, it does not print any of the information.
The problem is in the Query report, In the criteria box for field [RequsetID] it has
Code : [Forms]![FRMRequestForm]![RequestID]
(The above works outside the navigation form.)
I have also tried adding the navigation form name
Code : [Forms]![Main]![FRMRequestForm]![RequestID]
But none work.
I have a form called "Customer Details", on that form i have child forms, including one that has a schedule on.. so far everything seems fine, am able to get it to pull data correctly to the correct fields.. etc
I'm using 1 main table for all of this called "Cases"
Now the problem is, when i i click a button to print (this works so far), it opens another form and then fills in all the textbox's, however this is where i've got the problem, as it always seems to pull the data from the first record, not the record that i'm currently on..
so for example, if in the customer details, someone looks up "joe Blogs" using the navigation search and then wants to print it, by hitting the print button .. it should open another form, fill in the boxs and print "Joe Blogs", however it's always doing "Joe adams" - 1st Record
The code I have is.
Code:
Private Sub Command26_Click()
If Forms![test site]![prp test].Form.[A Right Answer] = -1 Then
Forms![test site]![number correct] = Forms![test site]![number correct] + 1
End If
DoCmd.FindNext
End Sub
Then when clicked it checks a yes/no box to see if "A right Answer" is the correct yes. Then it should pop to the main form and take the number correct cell and add one to it. I am trying to get the record to go to the next record inside the sub-form but docmd.findnext seems to be wrong too.
Hi Good-Morning (its morning here in Jamaica) (Whatever time of day it is where ever it is that you great minds are in this beautiful world we live)...
I created a form and used an image control with a filepathfield that is stored in my table,... that works well as far as displaying the correct picture for each record...
I now want to create a Continuous Form with the correct image displayed for each row or eachrecord///
The problem is all of the images are displaying the same picture, but i want them to show their correct pictures... I used an on current event which i guess is why tha is happening cause all the pictures change when different record selectors are clicked...
Please advise how i could get around this...
I looked at the Northwind database, but that database uses an OLE object, I would like to use the filePath field that i have in my database...
Any Ideas? Thanks in Advance
I have database of roughly 15000 records. The records have a unique number and the majority of searches etc work OK. The problem is with a form used to display record details with various sub forms embedded on the form.
Scrolling through displays the correct details.
Trying to use a combo box to determine the record selected does not work correctly.
The combo box is made up of 4 columns of "NAME", "COUNTRY", "ROLE" and "UNIQUE NUMBER"
Typing in the combo box auto fills in the NAME until the correct one is found. If the name is unique it opens on the form correctly. But if the name is not unique it does not always open the correct record.
Is there any way of being able to use the NAME to search through the combo box entries but use their unique number to determine the record selected.
A further problem arises as there are apostrophes in the NAME as well
What is the best way to impliment a query in a form so that the user can view the query records, and have the option to print or save the selected record using command buttons?
I tried subforms but I could not get the command buttons to work in the subform after it went into the form, it wanted to print the entire form instead of the selected record from the subform.
So in a nutshell I have 3-4 queries that are built, and I want to have them show up on my form in a format that the user can scroll through the results and select a single record of the results and then print or save that individual record from the form, if such a thing is possible.
Thanks in advance
Todd
I want a textbox on a form to record the time every record is printed. I used the codes below but it couldn't work. Am getting 'runtime error 2147352567 (80020009)'
Private Sub cs3_Click()
Dim mydate As Date
Me.hdates = Now()
DoCmd.Save acDefault
DoCmd.OpenReport "Copy of HH", acViewReport, , "[REF] = " & "'" & [ETGRef] & "'", acWindowNormal
DoCmd.PrintOut
End Sub
I currently am trying to print the current record that I have selected on my form and the subform that I have on the same page. If I try to print selected record it will only print out the main form correctly and will print out the first record on the sub form. I have tried to make a reprot of the current form and it only will do the main form and nothing from the sub form. I am willing to try whatever method would work in getting this to work. Thanks
View 2 Replies View RelatedI have a navigation form with a combo box. The combo box has a running list of manifest numbers. I select a manifest number, then click a button that brings up a new form with data related to the selected manifest.
However, I have to click and unclick the 'Toggle Filter' button on the new form to show the correct data each time I open the form.
I have a button on a FORM to print the current record with the following code:
DoCmd.RunCommand acCmdSelectRecord
DoCmd.PrintOut acSelection
But what I need is that before printing, open the preview to set the margins and page size ... or at least to pre-configure so that when you press the button, and comes preformatted.
My Main Form is a Popup Window with print button for other subforms. So I have it set so when the Report opens it hides the Main Form, and I use the
Code:
DoCmd.SelectObject acReport, Reports(0).Name, True
do get focus to Report, and I run a loop just to make sure it does actually have focus and the Main Form does not have focus.On my PC It works great it prints the report every single time, but when my colleagues are using it... it prints the Main Form instead of the report. I don't get why it would work on my PC, but not work on someone elses?
Code:
Public Sub FocusOnReport()
Dim intState As Integer
Dim intCurrentType As Integer
Dim strCurrentName As String
[code]...
How can I make sure it prints the report and not the MainMenu
OK, my database is also complete, thanks to the help of this forum!!!
My next question is:
I have a switchboard that has a button for my data entry form. The lady that will use this form will, of course, enter all her records using the form into the database. Because of what she does, she will have to go back to records on a daily basis to make corrections to individual records. I would like a way to put a command button on my switchboard that will say something like "Correct Records". She will hit this button and it will ask her for the medical record number she wants to correct and then will take her to that record to correct.
Is there a way to do this or is there a better way? Currently I have a button that will ask for a day range and then will bring up a query of those records for her to correct but I would really like to be able to somehow bring up the individual record, by medical records number, for her to correct instead of going through a long list of records that were input on a single day. Thanks so much for all your help getting this thing up and running!!!!
What I'm looking to do is calculate the success rate (%) of compliance rates with Quality Control paperwork. Essentially, each record has 12 "check box" fields representing the different QC sheets that are submitted each day.
QCflavourChange
QCfillerOperator
QCblowMoulding
QCtorqueTest
QCnetContents
QClabeller
QCpacker
QCpalletiser
RMpreform
RMclosure
RMlabel
RMcarton
I have been able to find the code for counting the success rate of a specific type of QC sheet across multiple days worth of testing, eg:
=Sum(IIf([RMpreform]=True,1,0))])
But I have been unable to determine how I can count the total of all the successful fields listed above, across a single record.
I have an old Access 2000 database which needs some functionality update, and I can't get things working as they should.
The issue is related to frmOrderDetails form based on tblOrderDetails table, with following fields:
Order_ID
Product_ID
Ordered_Quantity
Product_Price
For entering ordered products there is a combo box for Product_ID which is displaying information about available products, their stock level, and price.
The Row source for Product_ID looks like this:
Code:
SELECT DISTINCTROW [qryStock4Orders].[Product_ID], [qryStock4Orders].[Product_name], [qryStock4Orders].[Available_quantity], [qryStock4Orders].[Selling_price] FROM qryStock4Orders ORDER BY [qryStock4Orders].[Product_name];
qryStock4Orders holds the calculated values of stock level (Available_quantity) for each product, grouped by Product_ID and Selling_Price. Selling_Price is from tblX.
Because I can buy one product from different suppliers (for different purchase prices) and purchase prices (so selling prices too) of the same product may vary over time, qryStock4Orders may list more then 1 available Selling_Price for that product, for example:
Product_ID Product_name Available_quantity Selling_Price
123 Product xyz 12 25$
123 Product xyz 42 29$
123 Product xyz 8 30$
What I want to achieve is to turn this code placed on After Update event of Product_ID combo box
Code:
Dim strFilter As String
strFilter = "Product_ID = " & Me!Product_ID
Me!Product_Price = DLookup("Selling_Price", "tblX", strFilter)
in something usable, in order to save into tblOrderDetails the selected Selling_Price and not one random Selling_Price from the 3 available above.
As the stock level is updated only after Ordered_Quantity and Product_Price are entered manually, what I'm trying to do with the code above is to automate the data input into Product_Price field of tblOrderDetails.
Hi all! Going ga-ga over this, :eek: so please see if you can help!
Access 2000 by the way.
I've a really pretty form made up and it has 3 tabbed pages.Each page contains some fields which contain 'memo' data, so the entries in each field are pretty long.
When I try and print the record e.g. File->Print->Print selected record...it just
a)prints the front page/tab, as opposed to the contents of all 3 tabs
b)Truncates the data in the memo fields...it seems to just print the image of what you see when you open the form up - rather than printing the actual content of each field.
Similar thing when I try and print from datasheet view. Or from the table that the form feeds into.
What am i doing wrong? Please help! :D
Hi all! Going ga-ga over this, :eek: so please see if you can help!
Access 2000 by the way.
I've a really pretty form made up and it has 3 tabbed pages.Each page contains some fields which contain 'memo' data, so the entries in each field are pretty long.
When I try and print the record e.g. File->Print->Print selected record...it just:
a)prints the front page/tab, as opposed to the contents of all 3 tabbed pages
b)Truncates the data in the memo fields...it seems to just print the image of what you see when you open the form up - rather than printing the actual content of each field.
Similar thing happens when I try and print from datasheet view. Or from the table that the form feeds into.
What am i doing wrong? Please help! :D
I'd like to put a command button on a form that would run a designated report but have the option of only printing selected records. I know I could just use the File/print option using selected records but that only prints the record fields displayed in the form. I want to run a special report that formats and prints more of the records fields. The problem is how have that report print the "currently selected" record or records.
Thx.
This could go in forms or reports, I think but:
I have a database which I am developing over time as I see ways of improving it and as I learn bits of vba. My current problem relates to invoicing (that I have probably created for myself!): I currently have two invoice report layouts because of different invoicing addresses.
I now want to add a cmd button to my invoice entry form that will firstly preview, then print the current record. I found elsewhere in the forum a way of previewing just the current record by way of specifying in the underlying qry the ClientID so that it selects the record displayed on the form.
I have this line of code which then previews the invoice:
DoCmd.OpenReport "rptInvoicePrivateClients", acViewPreview
This does not take account, though of the different invoice layouts.
I think strictly speaking I should only have one invoice report, but what I want to say is this:
If the client is a private client, then preview rptInvoicePrivate,
Else preview rptInvoiceLocumWork
I have tried entering this code that does not work
If SolicitorID = "1" Then
DoCmd.OpenReport "rptInvoicePrivateClients", acViewPreview
Else
DoCmd.OpenReport "rptInvoiceLocumWork", acViewPreview
End If
It comes back with a message that SolicitorID is not defined, but I have included Option Explicit.
Any help please
I am looking to set up a database where I have a table of records that correspond labels to product numbers. The product numbers may have anywhere from 1 to 30 labels that correspond to them, and I want the user to have a form where they search by a product number and then the labels that correspond to that product number are printed out on an Avery label.
Here is how the main data table will look: (everything is simply arbitrary to illustrate)
For example: If I type in "1111" into the form - the labels that print would be AA, AB, AC, AD, & AE
I know how to set up labels to print using forms, but the only way I can think of this working is by looking up the product number in the table, then copying the row of labels into another table (let's call it "labels to print") and pasting them in a column, then printing to the labels, and clearing the "labels to print" table for the next time.
Is this the correct route to go? If so, how do I go about looking up the product number in the main table and copy them to the "labels to print table".
Hi,
I have a problem with making a (simple!) search form work in Access 2000. I wrote the code in (what i believe to be) Access 2000 version, and it runs on my machine that is Access 2002-3. The search form uses VBA code; an if-then logic for 3 fields that are chosen by the user, and discounts fields that are not selected. The code then filters results from a query based on 2 tables and presents these in another form.
This all works fine on my pc, and on others using Access 2002-3, with macro security set at medium (and macros approved to run). However, the search form does not work on pc's running Access 2000. I do not know the security levels for these pc's but please if anyone knows of what may be causing this... please help!!
Thanks,
KC
i have a form that pulls in a subform specific to the CurrentUser(). It is meant to be a shortcut or favorites form that holds 8 command buttons. I have Dlookups on the form to pull the correct fields from a table for OpenForm or OpenReport and then the name of the form or report they want to open. My froms work but when i try and open a report, it just prints the (correct) report and does not open it. I just want to open it.
Private Sub cmdBtn1_Click()
If Me.btn1Action = "OpenForm" Then
DoCmd.OpenForm Me.btn1Details, acNormal, , , acFormAdd, acWindowNormal
Else
If Me.btn1Action = "OpenReport" Then
DoCmd.OpenReport Me.btn1Details, acViewNormal, , , acWindowNormal
Else
End If
End If
End Sub
Hi all,
I've added a message box to what is basically a standard simple to use access control, "closeForm", I'm a newbie working on learning access vb. I'm guessing my code if fudged. Any help is greatly appreciated.
Private Sub Close_Click()
On Error GoTo Err_Close_Click
Dim Answer As Integer
Answer = MsgBox("Press Ok to Close, Cancel to Continue.", vbOKCancel + vbQuestion, "Exit Data Entry?")
If vbOK Then DoCmd.Close
Exit_Close_Click:
Exit Sub
Err_Close_Click:
MsgBox Err.Description
Resume Exit_Close_Click
End Sub
Thanks to all in advance
I have one-page forms which print a second page, blank except for a block of grey shading at the top. I have tried moving the content of the form up but that doesn't eliminate the second page. If I look at print preview, every second page of the entire database shows up as blank, regardless of where that happens to appear in the record.
View 2 Replies View Related