My Pipe's not working!

MackMan

Registered User.
Local time
Today, 06:57
Joined
Nov 25, 2014
Messages
174
Hi all.

I know this has been covered many many times before, but... I can't seem to find the answer I'm looking for in my particular situation.

Form... and Popup form.

So I want to pass some data from a Main Form to a continuous popup form, where I am ADDING data.

the openargs from the main form are...

Code:
DoCmd.OpenForm "frmREGISTERSplitsPopup", acNormal, , , acFormAdd, , Me.TopLineID & "|" & Me.TransDate & "|" & Me.txtAmount
the Onload event code for the popup form is...

Code:
Private Sub Form_Load()
Dim args As Variant
 DoCmd.MoveSize 8000, 5000, 12500, 9000
 If Not IsNull(Me.OpenArgs) Then  ' form is being opened from a form passing it's data
args = Split(Me.OpenArgs, "|") 'using the "|" as the delimiter
Me.TopLineID = args(0)  ' 1st Value
Me.TransDate = args(1)  ' 2nd value
Me.txtregistertotal = args(2) ' 3rd value
 End If
 
End Sub
but something odd is happening which I will try to explain...
All data passes, but is only good for the first line (TopLineID and TransDate)... the third value is just a total in the form footer.

How can I make the TopLineID the same, as well as transdate for each new line I add?

As always, super thanks...
 

Attachments

  • popup.jpg
    popup.jpg
    18 KB · Views: 98
Your pipes are working! :)

How can I make the TopLineID the same, as well as transdate for each new line I add?
Set the Default Value property of those controls using the values derived from the split openargs string.
 
Ah... the simplest things... I will get this one day... - hopefully!!

Thanks vb
 
one thing... Do I need to do something with the date format?

From the tables to the forms, everything is formatted to Short Date, but this happened....

I need a beer!

30/12/1899
 

Attachments

  • popup.jpg
    popup.jpg
    15 KB · Views: 76
I need a beer!

30/12/1899
Doesn't that correspond to your date of birth? :)

You've just split a string so it's not properly formatted as a date. Re-format it using the appropriate date functions before passing it to the Default Value. Also check that the value you're passing to OpenArgs is actually properly formatted.
 
Doesn't that correspond to your date of birth? :)

Not far off tbh.:cool:


I've been having a mooch round for correctly formatting it after it's been pulled by the openargs. I'll let you know how I get on.

Thanks again.:)
 
Doesn't that correspond to your date of birth? :)

You've just split a string so it's not properly formatted as a date. Re-format it using the appropriate date functions before passing it to the Default Value. Also check that the value you're passing to OpenArgs is actually properly formatted.

Here's what I managed, and it's working (at this stage of learning, I have no idea how):confused:

Code:
Me.TransDate.DefaultValue = Format(args(1), "\#mm\/dd\/yyyy#\")
Many thanks for you help vb. It really is appreciated.
 
Very good MackMan!

Perhaps CDate(args(1)) would have sufficed as well but the Format() function in that format is ideal.

Remember to test for the empty string ("") just in case a date value wasn't passed, it will fail otherwise.
 

Users who are viewing this thread

Back
Top Bottom