My Assistant
![]() ![]() |
|
|
Dec 28 2010, 04:52 PM
Post
#1
|
|
|
UtterAccess Addict Posts: 132 From: South Staffordshire, UK |
Hi,
I have a form that looks up quotes to customers. At the time of creating the quote, the parts may not be set up on the system. If the customers later accept the quote, I want to be able to open a form with the quote details and then have an option to create the part on the system without having to keep closing one form and opening another. I have set the contol on the quotes form that opens a second form to add the new part (ProductAdd), but I'm having problems passing the OpenArgs values. The three values I want to pass to the ProductsAdd form are: ProductId - The part number ProductName -The part description CustomerId - The customer identifier which is on a parent form. I've set up a function ParsText: CODE Public Function ParseText(TextIn As String, x) As Variant On Error Resume Next Dim Var As Variant Var = Split(TextIn, "|", -1) ParseText = Var(x) End Function Then when I click on the control it runs the following code: CODE Private Sub SetUpPart_Click() On Error GoTo Err_SetUpPart_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "ProductsAdd" DoCmd.OpenForm stDocName, , , , , , "'ProductId'|'ProductName'|'Me!Parent.QCustomerId'" Exit_SetUpPart_Click: Exit Sub End Sub Then on the ProductsAdd form I have the OnLoad event: CODE Private Sub Form_Load() If Not IsNull(Me.OpenArgs) Then Dim strA As String Dim strB As String Dim strC As String strA = ParseText(OpenArgs, 0) strB = ParseText(OpenArgs, 1) strC = ParseText(OpenArgs, 2) ProductId = strA ProductName = strB CustomerId = strC End If End Sub My problem is that I can't get the argumnets to pass their actual values. For example, if ProductId on the quote is 123456, it actually comes out as 'ProductId' and the description comes out as 'ProductName'. I've tried using the square brackets around the values "[ProductId]|[ProductName]|[Me!Parent.QCustomerId]", but this still doesn't work. Any help appreciated Terry |
|
|
|
Dec 28 2010, 04:56 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 3,780 From: Washington State |
Assuming these are variables, you can concatenate them into a string for OpenArgs thusly:
ProductId & "|" & ProductName & "|" & Me!Parent.QCustomerId |
|
|
|
Dec 28 2010, 06:39 PM
Post
#3
|
|
|
UtterAccess Addict Posts: 132 From: South Staffordshire, UK |
Thanks Sam, worked a treat! (IMG:style_emoticons/default/thumbup.gif)
One day I'll get all this syntax sorted - until then I'm glad there's this forum. |
|
|
|
Dec 29 2010, 11:51 AM
Post
#4
|
|
|
UtterAccess VIP Posts: 3,780 From: Washington State |
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 19th June 2013 - 11:52 AM |