I imagine the SQL must pass 2 values, the value shown in the table and the link to which that value navigates.
I'd appreciate a pointer to the SQL Script for achieving this. Thanks.
The format for a hyperlink column (field) is:
Description#Address#
For example:
This is StackOverflow#http://stackoverflow.com#
Mr E Xample#mailto:example#example.com#
For the most part, I prefer to avoid hyperlink fields (columns) as editing them is a real problem. A text or memo field with a little code is much simpler, though you will need a form.
If you're looking for a query to extract the Description and Address from a hyperlink field, try this:
SELECT
hlink,
Left(hlink,InStr(1,hlink,"#")-1) AS link_description,
Mid(hlink,InStr(1,hlink,"#")+1,InStr(InStr(1,hlink,"#")+1,hlink,"#")-InStr(1,hlink,"#")-1) AS link_address
FROM tblHyperlink;
It's sure not pretty. And it will return #Error for hyperlink fields which are Null or contain less than two # characters.
Related
My apologies but I am a bit lost in the world of Microsoft Access. So I currently have a query that returns a column of values. The output looks like this:
SMABranchCode
Code1
Code2
Code3
etc.
This query then gets moved to a form text box. To do this, I have used Control Source like so:
=IIf(IsNull(DLookUp("SMABranchCode","PWS_SM_QUERY"))," ","X")
This works "Ok"; however there are going to be probably 30+ more text boxes going horizontally next to this one all running the same query. Above them is a label with the Code. So basically when it spits out the data it looks like this (as long as there is an entry for that code):
Code 1 | Code 2 | Code 3
X | X | X
The problem is, I either need to go and create a query for each of these text boxes so that it only pulls a single entry for each Code OR I can hopefully change up my Control Source entry (=IIf(IsNull(DLookUp("SMABranchCode","PWS_SM_QUERY"))," ","X")) to include criteria so that each text box has its own Criteria, so that from the one original query, each Code (1,2,3) only displays its information.
I have tried changing DLookUp to have criteria which has looked like this:
=IIf(IsNull(DLookUp("SMABranchCode","PWS_SM_QUERY","SMABranchCode = Code1"))," ","X")
However that gives me an #Error! in the boxes I apply it too. I'm hoping maybe someone can help me figure out a solution since my brain is turning to mush over this.
Thank you
I presume SMABranchCode is a text type field. Criteria values for text fields must be delimited with apostrophes, date/time field values would use #.
"SMABranchCode = 'Code1'"
I am trying to do a report on SSRS and the first parameter I have to enter it manually or can Copy paste it from a excel file(one by one). Sometimes there are spaces before the ID.
The other 2 parameters are dependent on the first parameter.
I am trying to figure our what can be done in order to just take the ID when entered into the parameter box. I have attached a picture for your reference.
I'm assuming that you want to use this parameter in a SQL query?
If so, in your query why not just trim the leading spaces from the value like this:
where ID = ltrim(#ID)
If I have misunderstood, please add some more information to help clarify exactly what you're trying to do.
I inserted three text boxes to test how this could work:
Text81: =1
Text82: =2
Text83: I want this one to be the sum of Text81 and Text82
Thanks in advance for your help on what I think is a pretty simple problem.
There are a couple options that spring to mind.
First you could always modify the data source for the report to include the calculated field.
Second, which is what your question drives at, you can do something like this:
=[Text81] + [Text82]
Should work when typed into the Control Source of a TextBox provided Text81 and Text82 are the data field names from the Data Source of the Report. If they are not you would put the corresponding data field names in the square brackets []
Hope this helps
My situation/problem:
TableA
id, postalcode, region
Criteria for the field i want to add value in (postalcode):
=IIf([tableA.Region]="Chicago","60064",[postalcode])
What i need to accomplish is an iif-query where:
In the field postalcode I check in the criteria if the field region equals Chicago. If so fill up the field with postalcode 60064 if not DO NOTHING
For the do nothing part I'm using the fields name, this is wrong?
am i using the criteria in the right field (the field i want to add?)
I'm using a selection query?
As you can see i'm a noob in access queries...
Can somebody give me the right iff statement?
Thx in advance,
D
I'll suggest you bracket table.Region differently, or eliminate the brackets there entirely.
=IIf([tableA].[Region]="Chicago","60064",[postalcode])
=IIf(tableA.Region="Chicago","60064",[postalcode])
If that doesn't fix the problem you're trying to solve, tell us more about the problem. If you're getting an error message, tell us what it says.
Taking a wild guess, that code as a field expression in a query will not give you an editable column in the query result set. If you want to pre-load a column value based on your criteria, but then allow the user to change the value, use a form. In the form's On Current event, load the value as you wish.
This is a dead old post but I think this was what you wanted:
=Like IIf([tableA.Region]="Chicago","60064",'*')
As far as I can understand,
if not DO NOTHING
You need to return nothing if the condition is false.
What you need is the WHERE clause instead of IIF
If I'm understanding your question correctly, you want a NULL value in Postal Code if it's not Chicago?
=IIf([tableA].[Region]="Chicago","60064","")
Please add another IIF query as OR
IIf([Forms]![Run_Macro
Form]![ReturnType_DrpDwn]="Monthly",[Forms]![Run_Macro
Form]![Cmb_Per_Ending],#1/1/2010#)
IIf([Forms]![Run_Macro Form]![ReturnType_DrpDwn]="Quarterly",#1/1/2010#,#1/1/2025#)
How do I bind a text box with a field, which doesn't belong to form's "Record Source" table, through the Design View?
Example: I have "Order.cust_id" (Record Source=Order) and I want to display "Customers.name". I believe it is trivial but I have no experience with MS Access. I tried to use the text box "Control Source" property but no luck.
One method would be to convert the text box to a combo box. Then set the row source to include both the cust_Id and the Customer.Name from the customer table. SQL statement example
Select Cust_ID, Name From Customer
Order By Name;
By setting the number of columns to 2 and the column widths; the first column as zero (i.e. "0;6") then the foreign key would be hidden from the user and the customer name would be displayed.
Note this method does force you to have limit to list set to true.
Also you do end up with a drop down list which may not be what you want.
You can use DlookUp as the control source of a textbox:
=DlookUp("[Name]", "Customer", "ID=" & Cust_ID)
Syntax: What to look up, table name, where statement
The Where statement should follow the rules for Jet SQL, which means that you must use delimiters if the field is text or date format.
Note that Name is a very bad name indeed for anything. I suggest you rename the field immediately before things get worse.
It can be useful to know the error(s).
You could create a new View (e.g. OrdersAndCustomerNames), select all the columns you want to use in the form, then instead of using the Order table as Record Source, you would just switch to OrdersAndCustomerNames. You say you have no experience with MS Access, so I am guessing you are not building anything huge and overly complicated, so I would do it this way. I am quite sure it can be done more elegantly but this will do for now.