MS Access enter parameter value for report - ms-access-2007

I have a report/letter with a query as its record source.
Some of the paragraphs I would like the user to be able to amend instead of asking each time it needs a change.
I set up a local table called LetterWording; this has one record with four short text fields which contain the wording for the paragraphs which need amending.
In the letter I added textboxes for these paragraphs with the control source pointing at the relevant field (e.g. =[LetterWording]![1stInterviewParagraph1]).
However, when I open up the letter in report view I get the Enter Parameter Value popup asking for LetterWording.
If I click OK without entering anything (I don't know what it wants anyway) the letter opens and those four paragraphs say #Error.
Can anybody please advise what I'm doing wrong here?
Thank you!

Just me being silly. As I can't/don't want to add to the original record source query I should add these paragraphs as sub-reports.

Related

SQL Divides the data into 2 after Dot Issue

I have a table which I update using a stored procedure. One column is for the image Url. The code in the stored procedure looks like:
UPDATE Products
SET ImageUrl = 'https://images.XXXXXXX.com/lm/image/s/'+RIGHT(Source,2)+'/'+Source+'_'+Code+'.203'
I need the url to be in a single line in the cell however, it splits the url right before .203 when writing it into the cell. So, in the cell, it is like;
https://images.XXXX.com/lm/image/s/ab/g671235_12312
.203
It normally is no problem for me but I use this data in XML. And Since the Url is not in one line, the remote server I connect does not update the image when I submit the XML. When I manually fix the Url and put it in one line, it just works fine. I googled and searched to find a way to fix this issue, but I could not find a solution. Any help will be appreciated.
Thanks
It sounds like there is a carriage return/newline feed captured within your "Code" column. I have encountered this many times when users manually fiddle with values (they update the value and then hit thinking this will apply the value when this is just inserting the r\n\ values within the column).
To double check if this is the case:
Locate the value that is causing this line break to appear
Copy that cell value (I assume you are using SSMS)
Open Notepad++, Sublime, or similar editor that will display non-printable characters
Set your editor to display non-printable characters (in Notepad++ it is View > Show Symbols > Show All Characters)
This should then display the line break characters that are causing your headaches
Quick solution: Scrub \r\n values - https://stackoverflow.com/a/951705/8026186
More Ideal Solution Prevention of \n\r insertion
If you have access to the data being entered in the database, the best way to avoid this is to prevent the \r\n from making it into the cell in the first place. The quick solution will work in case you don't have the leverage to control initial input. However, from past experience, you will want to avoid non-printable values from appearing in the first place.
Hope this helps!

Extracting Data From SAP Into Excel .currentcellrow

I am trying to pull data from SAP into Excel from a list inside SAP. Normally when I click a field, I get a string of code with either .setfocus or something similar that I can change to a .text and set the line equal to a variable.
When I click a field in this list I get something like this
session.findById("wnd[0]/usr/cntlCUSTOM/shellcont/shell").currentCellRow = 2
What I need it to be able to make this variable to loop through, and in every iteration assign the SAP Cell value to a variable.
Does anyone know what I can do to accomplish this?
Okay I have no memory of asking this question in the past, but I apparently did. Here is the link to the answer from before.
Extracting .currentCellRow fields from SAP to Excel
Admins: Feel free to remove this post since it is a duplicate. Sorry for the inconvenience!

Access Query uses Form Inputs as Parameters - Runs manually, not through Form

I have a query that accepts input from a form. The query works as expected when I run it, manually typing in the form input values. However, when I run the query from the form, the query returns blank - no error, just blank.
I don't understand what's causing it - at it's most basic, the user is simply entering a Start and Stop date. I'm entering the data exactly the same, and made sure my form text box is formatted as a date.
Furthermore, when I run the form, I am not prompted for any values, so I know it's reading them accurately. This system works for several similar queries, but not this one.
What I've tried
Changing the format of the text box to specify Short Date (which is how I type it)
Visually confirming the values are making it from the form to the hidden staging area the query references - these values match what I manually enter into the prompts
The query I'm runnning references another query; running the other one by itself only yields one set of "date" prompts, not two. So I created a seperate date input box for each to read off of, but to no avail
Question: Does Access try and format (or not format) parameter input boxes differently than it would handle form references?
Additional detail - when I run the query manually, it prompts me for the dates twice - I don't know why or it's pertinent, but I thought I'd mention it.
use instead Temporary variable in your Query for the specified dates. After you select the dates from the Form, make sure that the values are assigned to the temporary variables and that you requery the record source of the form
I was able to get this working by tweaking my query in the designer - specifically by splitting up my expression into multiple pieces and writing the criteria in segments.
I'm not sure why this did the trick, but it at least got me where I needed to go.
Good luck to anyone else experiencing this!

Automate adding bookmarks to tables and then create an index

I have a program which outputs a collection of tables in a word document which I eventually want to post as an html file with bookmarks and an index. The tables are grouped by "Name:" where there is a 3 row table that contains detailed header information for a section of data, then there is a second table which can span multiple pages which contains the data for that section. There is then a page break so that the next sections header table is on a new page. This can occur for a variable number of sections numbers in the hundreds. I need to write a script that
searches my document for "Name:", which is unique and would not
appear anywhere but the header table,
grabs the text that follows "Name:" within that table cell (for example "Name: Line 1234)
replaces all the blanks in that text string with an underscore to
make it a suitable bookmark name,
creates a bookmark with the name,
goes back and creates an index at the front of the document
Saves the file as an html
I have a passing familiarity with VB for word, I have used it a bit in excel, but am by no means an expert. I would appreciate any advice on functions and objects that I should be using for this script.
Hey MikeV from what I can gather, your problem seems more conceptual, less specific. What I mean is, have you started yet? Or looking at a blank script page?
I'm relatively new to coding, so I get that myself. What I do is make a list of what I need to do (what you have). Then think of the code or psuedo-code that would go with each step. Then you can start to build your script. You don't have to start with step one (as step 2/3 is often the more interesting bit), but let's do that.
Now, you need to search for a text string containing "Name:". I am proficient with VBA in excel, but haven't done anything for word. So I'd look it up. Googling "VBA find word in word document" will bring you to this page, which shows you how to approach step one. So steal their code, alter it to fit your needs and move on to step 2. Repeat the process, and that's how you build your algorithm! :)
Just a FYI, typically StackOverflow is for specific questions with an answer that can be confirmed, whereas you asked for help building an algorithm. I'd reserve those questions for your programming professor or friend who can help.
cheers

Create a report that could be one page or two, depending on what field was modified

In an alternate application, the user has the ability to update their address and phone number. When these are changed, three fields will update: Old Value, New Value, and Field Changed. If the Field Changed was the address, I need to create two report pages - one with the old address and one with the new. However, if the Field Changed was the phone number, I only need to create one report page for the current address.
My initial plan was to do a Union that would have one record with the Old Value and another with the New Value. This should work when only the Address has changed. However, it won't whenever the Phone Number has changed. I assume I need to do some sort of case statement, but I'm not really sure if this is the right approach. Sorry if the data is a little confusing (I didn't design the data structure. This was provided by our professor's assistant). If you need more information, I'll try to provide it.
I'm not looking for exact SQL, but I am wondering if I'm approaching this the correct way.
What do you mean by a 1 or 2 page report? Are you outputting to a CSV, PDF, XLSX or something eles?
If you need to do this through "pure" sql I would recommend a stored procedure that is given a value stating whether it's the address or phone number that is being updated. It can then do the update and you can simply do an if statement which determines which report to run and return.
I'd recommend handling it programatically if possible. Have your code run the sql update and then call the appropriate function within your code to get the report you need. You can then easily re-use the code for that report in other ways.