Question Insert two values into a cell

CM670

Registered User.
Local time
Today, 14:39
Joined
Oct 19, 2012
Messages
10
I have a table which holds the status of peoples orders. It holds information on order_id, order_status, order_desc, letter.

A letter is printed for each of the different statuses. However for one status i need two different letters to be printed.

How can i insert two values into the same cell.

So far i have done
insert into order_status (order_id,order_status,
order_desc, letter) values('025', 'Dispatched', 'Black tailored coat ','DPT notification');

This prints the DPT notification fine but i need another letter to print along with this.

It would be helpful if anyone has any ideas on how to do this!
Thanks.
 
Are you essentially wanting to take the value from two different fields and store them in a 3rd field joined together?

I am trying to understand if your problem lies in merging the data into one field or triggering two reports off the value in a field?
 
I just need to insert data into a cell in the table. In the letters cell i need to insert two different letters so that both of these are printed.

So far i have put
Code:
Insert into orderstatus (order_id,order_status, 
order_desc, letter) values('025', 'Dispatched', 'Black tailored coat ','DPT notification, DPT2 notification2');

This prints the first letter (DPT notification) but not the second (DPT notification 2)


I am developing a program so that when the status of an order is changed (using a dropdown) different letters are printed automatically according to the status. All the documents are stored in the sys_doc_table. The insert statement works fine for all the statues that only have one letter but not those that have two that need to print together.
 
You say print but it sounds like you are trying to insert them into a table with that code. I don't see any code that calls an export or print function.
 
You say print but it sounds like you are trying to insert them into a table with that code. I don't see any code that calls an export or print function.



i already have code to print them. I just need to insert the information into the database.

Thanks
Ciara
 
Okay can you show the code you have for Print?? I think you should be using InStr and Mid to get the information.. I have no idea what your code looks like.. but I am just using a dummy code..
Code:
letterToSend = DLookUp("fieldName","tblName","criteria = Something")
commaPos = InStr(letterToSend,",")
If commaPos > 0 Then
    secondLetter = Mid(letterToSend,commaPos+1)
End If

If Len(secondLetter & vbNullString) > 0 Then
   [COLOR=Green] 'code to print second Letter[/COLOR]
End If
 
Sorry, I was getting hung up on the word "Print". Couple ways you can fix this but the easiest would be to use vba to set the merged fields.

Form1
-----------------
1stFieldToMerge
2ndFieldToMerge

-----------------

You can set your output field (the one that holds the merged values) by defining a trigger to run VBA code on your form like the "on dirty" event and use the following.

Code:
dim 1stfld as string
dim 2ndfld as string
dim 3rdfld as string 
 
1stfld = Forms!Form1![1stFieldToMerge]
2ndfld = Forms!Form1![2ndFieldToMerge]
3rdfld = ((1stfld) & ", " & (2ndfld))
 
Forms!Form1![MergedOutputField]= 3rdfld

written from memory so double check my syntax if you get any errors.
 
Pr2's solution looks good to output the field into seperate reports. Mine will help you get both fields stored into the same field in your table.

Two sides of the coin.
 
NP, let us know if it works for you.
 
Glad to help.. but we are not sure which option you chose.. Let us know what is the outcome.. Might help someone in future..
 
Both options were very helpful. I went with the option provided by Tango! :)
 

Users who are viewing this thread

Back
Top Bottom