Override qty on a label

bulrush

Registered User.
Local time
Today, 10:03
Joined
Sep 1, 2009
Messages
209
A2003 on Winxp

On a form a user enters a job number, then clicks a button to display a report in preview mode. This report prints a simple label with 3 fields. This report is based on a query, where the key field is taken from the form. One field on the report contains the quantity. The qty defaults from a field in a query that the report is based on. I would like, when the report preview is run, a window to pop up, showing the default qty, and allow the user to override the qty shown on the label. The qty is shown in 2 fields: human-readable form and in barcode form.

- Where do I put the Inputbox() function to ask for the new qty?

- How and in what event do I change the qty fields (call them txtQty and txtQtyBarcode) after the user clicks the OK button on the Inputbox() window?

Thanks.
 
Isn't there a way to do this at the query level? Like, I enter a prompt string in the query somewhere, and when the query runs, it asks me for a value. I remember doing this many years ago but don't remember how.

EDIT: a parameter query is where you enter a value in the criteria area. The question in the criteria area looks like: [Enter value]

This criteria then selects records based on the value you enter. This parameter thing will not work for me. I do not want to select based on the qty, I have already selected records based on a job number. I simply want to override the qty that appears on the record.
 
Last edited:
This is what I have in my Report_Activate event:
Code:
Private Sub Report_Activate()
Dim s As String
Dim procname As String
Dim i As Integer

On Error GoTo MyError
procname = "Report_Activate"
s = InputBox("Enter quantity in box", "Quantity override", Me!QTY)
s = Nz(s)
If (Len(s) = 0) Then
    s = Str(Me!QTY)
End If
txtQty = Val(s) ' <== Error here.
txtQtyBarcode = "*" & s & "*"


Exit Sub
MyError:
Call DispError(procname)
Resume Next
Exit Sub

End Sub
But I keep getting an error "-2147352567 You cannot assign a value to this object" in the line indicated above. How do I solve this?
 
On a report you can't change the values of bound controls.

Run an append query to change the quantity before you open the report. Use a form to get the new quantity value.
 

Users who are viewing this thread

Back
Top Bottom