I have successfully created a temporary table that populates all current printers on the machine for a picklist of printers to print to. But, when I try and change the printer in the report I can't get it to reference the printer that I selected.
If I put this code straight into the on-load event of the report I am trying to run
Application.Printer = Application.Printers("\\CBMSRV\Shipping")
The report populates and when sent to the printer it goes to the printer in the code (\\CBMSRV\\Shipping in this example). But that is hardcoded and I want it to select from the drop-down box the user selects.
This is what I have tried, along with other versions and can't seem to find out what I am doing wrong.
Dim prN As String
prN = Forms!\[frmprinterselect\]!\[Combo0\]
Application.Printer = Application.Printers(prN)\
The current value of combo0 is \\CBMSRV\\Shipping (along with other values)
I have also tried changing the value of combo0 to \\CBMSRV\\Shipping and that doesn't work either.
Thank you.
Related
I have a query that get a value from a query field. once I open the form and choose the value and I open the query it does open with no problem. I want to put a button in the same form that will allow me to open the query. Once I put the button and use the button wizard to make it open the query I get this issue once I press on the button:
The query:
SELECT Courses.Course_Id AS رقم_الدورة, Courses.Course_Name AS اسم_الدورة,
Courses.Date_Course AS تاريخ_الدورة
FROM Courses INNER JOIN Colleges ON Courses.college_Id = Colleges.college_Id
WHERE Forms![FormName]![colleges].Value=Colleges.college_Name;
Note once I open the form and open the query I get no result. but once I close the form and open the query, the query will ask me to type in the input manually and once I type in the input manually I get the right result. But once I open the the form it wont ask to input because it should take the value from the combobox colleges and it do but I think it takes something wrong knowing that the combobox contain text.
The issue I had is that the comboBox by default contain of 2 columns 0 and 1 and in the query by it self it is not possible to specify the column as I tried to specifying the column using or ![Column(1)] or even .Column(1) but none of them work and I search more this features is no more allowed since access 2013 in the query which means I should use VB to resolve it but as I continue to search I was able to do it by using a textbox so I created a textbox that read the information from the combobox and as I did that I was able to read the information from the textbox in my query
I have a report that changes based on the query used in the record source.
I did this to consolidate 6 different reports that printed the same formate and to the same label printer but they all used different data types/sources. I was able to convert all by 1.
The one I am having trouble with is one where there is a form, with a combobox and a textbox. The combobox has a table that its connected to with 11 different symbols ranging from Hearts to & and # stuff like that. The textbox will take any number/text combo.
When I run a query that I set up with [Forms]![frmPrintPtouchLabel]![txtName] and [Forms]![frmPrintPtouchLabel]![cmbSymbol].
The query pulls the right information except for the symbol that columb is left blank. Can anyone provide any reasoning as to why this is happening and how I can fix it?
Thank you.
Looks like there was fluke somewhere in my code or I was just over thinking something. After setting up a blank query I set a field: Symbol: [Forms]![frmPrintPtouchLabel]![cmbSymbol], and a field Name: [Forms]![frmPrintPtouchLabel]![txtName]
and I set up a button in a form that does DoCmd.OpenQuery "qry_TestQuery", in that same form there is the combobox with the Symbols, and a textbox for the Name, when I input those two and click the button the query opens with the proper information. Thanks for all that helped.
I have searched everywhere for this and tried different criteria but for whatever reason the form which has a control box set to open a report which is based upon a query will not pull the data within the date range. Instead keep getting enter parameter value dialogue box.
The criteria in the query is stated as Between [Forms]![Form1].[StartDt] And [Forms]![Form1].[EndDt]
The form has two date inputs StartDt and EndDt and is pointed to open the report. Without the above criteria in the query the form opens the report and produces all the dates. So at least it allows me to enter dates and is connected to the query and report but without the criteria fails to isolate data within the required range.
When I place into the query containing the criteria (as above) under the appointment date field all im getting are two parameter value dialogue boxes one after the other displaying Forms!Form1.StartDt and the second, Forms!Form1.EndDt.
Apologies for being long winded but am desperate to solve this issue am new to access.
Thanks to everyone for any input.
Iain
It seems you have an error in your names. One of the easiest ways to check form names is to use the immediate window. Type ctrl+G and you will end up in the code window with the cursor in the Immediate window. With the form open and a date filled in, type or paste
?forms!form1!StartDt
Into the immediate window and hit return. If you get an error, it means that you have a name wrong somewhere along the line, either your form is not called Form1, and form names can be a little complicated, or your control is not called StartDt. So this is where the version of Access comes in. In Access 2010, if you type Forms! on the criteria line of a query and wait a second, it will give you a list of forms. Pick your form from the list and type ! after the name, Access will come back with a list of controls. Pick your control. You should now have the right form and control name.
I have an Access form with a textbox that is uses as an expression as it's controlsource to calculate a value to display. While the below expression works fine in Access 2003, it doesn't display in Access 2007 automatically. Only when I click on the field, does the value display. What is does is it checks the database for a value based on other fields on the form. If its NULL, the field displays a "N/A". If it's not NULL, it displays the value found in the database.
Does anyone know what I might be doing wrong?
=IIf
(
IsNull( DLookUp("SomeField","SomeTable","SomeField = Forms!frm_FormName!cboSomeCombobox")),
"N/A",
LookUp("SomeField","SomeTable","SomeField = Forms!frm_FormName!cboSomeCombobox")
)
Issues that are fixed in Access 2007 by the 2007 Microsoft Office suites Service Pack 1
On a Windows Vista-based computer, fields that are bound to time-intensive
expressions are blank in Access 2007
Fields that are bound to time-intensive expressions are blank in Access 2007.
These fields are empty until you click the text box or until you click anything
outside of Access 2007 if the following conditions are true:
The Control Source property of a text box uses the DLookup() function.
The query that is called by the DLookup() function references a control on
a form.
http://support.microsoft.com/kb/942378
I've run into this before. Previously I found mentions of it on a couple of different Access VBA forums after searching with Google, but now I cannot find any of these hits.
I've been fiddling with this for hours today. I tried a variety of code bits in various events, but as any of us know from running into this problem, the Report View has vastly fewer event triggers than does Print Preview. However, I did find a workaround and a couple of important discoveries regarding this irritating bug:
The TextBox need not receive focus; simply accessing the .Value property is sufficient to give it the kick in the pants that it needs to properly display its contents. As such, the .SetFocus method isn't necessary.
The Section_Paint event is sufficient for this purpose.
The following bit of code worked for me. Of course, change the section and control names to match those on your own report.
Fair warning: This causes screen flicker on my system when the report is scrolled. I did attempt to disable screen updates with Application.Echo, but this only made the flicker worse. It seemed like each and every line of code added to the event, no matter what it was, made the flicker worse; it seems to be a timing issue:
Private Sub GrpGlacctFooter_Paint()
Dim DummyVar As Variant
'DummyVar can be reused for each control. We just need somewhere (anywhere) to
'stuff each .Value. Simply accessing .Value in any way is enough to trigger the
'TextBoxes to display their contents.
DummyVar = txtAcctSubtotalMessage.Value
DummyVar = txtAcctTotalSpent.Value
DummyVar = txtAcctRemainder.Value
End Sub
I have been battling with this problem for weeks now and simply cannot find a solution.
I am using MS Access 2007
I have a table caled "Policy Information" where all of my data is stored. I have created a combox box to autofill a few text fields using a query called "BC Allocation Query". By choosing from the combox269 field I created then 6 other text fields are automatically completed. I used the function =[Combo269].column in the control field of the text field I want auto-completed.
This all works great however I cannot seem to relfect the information from the text boxes which are auto-completed to relfect in my Access Reports whcih I have set up.
Please can someone assist me withthis before I jump off a cliff:)
Are these text fields on the form bound to fields in the source for the form? If not, they are unbound, and you need to write code to save this information into the table when you navigate away from the record or close the form. If they are bound, you need to programmatically force a save of the record when VBA changes values, otherwise - you might get the dreaded 'values changed by another user' verbage in an error.