UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Retain Openargs For New Records, Office 2007    
 
   
Scot
post Feb 23 2012, 11:04 AM
Post #1

UtterAccess Guru
Posts: 752
From: Silver Spring Maryland, USA



That might be the worst title I've used to date.

This is my first stab at OpenArgs and I admit that I am definitely not familiar with its mechanics. I have a switchboard that contains a combo to select a customer and a command that fires the following code.
CODE
    DoCmd.OpenForm "FRM_Input_PTP", , , , acFormAdd, , "CustVehID|" & Me.Cbo_SelCustVeh
FRM_Input_PTP has this on its OnLoad event.
CODE
    Dim x As Variant
    Dim strControl As String
    Dim lngID As Long
    If Len(Me.OpenArgs) > 0 Then
        x = Split(Me.OpenArgs, "|")
        strControl = x(0)
        lngID = x(1)
            
        Me(strControl) = lngID
    End If


This works pretty well. My form opens and it autocompletes my controls that refer to CustVehID so that I need only enter the "order" info that the form is used for. My problem comes when I use the FRM_Input_PTP's GoToNewRecord navigations. When i do this, I lose my CustVeh information. It requires that I reenter this info and well I can't seem to figure out why/how to "save" it for all new records.

Any suggestions?
Go to the top of the page
 
+
theDBguy
post Feb 23 2012, 11:49 AM
Post #2

Access Wiki and Forums Moderator
Posts: 48,113
From: SoCal, USA



Hi Scot,

What does your GoToNewRecord code look like?

Just my 2 cents... (IMG:style_emoticons/default/2cents.gif)
Go to the top of the page
 
+
Scot
post Feb 24 2012, 11:39 AM
Post #3

UtterAccess Guru
Posts: 752
From: Silver Spring Maryland, USA



I was just using the macro actions and the record navigation at the bottom of the page.
Go to the top of the page
 
+
ace
post Feb 24 2012, 12:33 PM
Post #4

UtterAccess VIP
Posts: 5,280
From: Upstate NY, USA



Declare the two variables outside of the Open event code. That way they will stay in scope when the Open
event ends.
Go to the top of the page
 
+
theDBguy
post Feb 24 2012, 12:34 PM
Post #5

Access Wiki and Forums Moderator
Posts: 48,113
From: SoCal, USA



Hi Scot,

I just did a test using the nav buttons and the OpenArgs didn't go away.

There must be something else going on in your form that we don't see. Are you assigning any values to the controls in the form's current event?

Just my 2 cents... (IMG:style_emoticons/default/2cents.gif)
Go to the top of the page
 
+
ace
post Feb 24 2012, 12:37 PM
Post #6

UtterAccess VIP
Posts: 5,280
From: Upstate NY, USA



Move the code that assigns the vale to the control to the Current event
Go to the top of the page
 
+
Scot
post Feb 24 2012, 01:22 PM
Post #7

UtterAccess Guru
Posts: 752
From: Silver Spring Maryland, USA



Moving it to OnCurrent worked! Thanks for helping me guys!
Go to the top of the page
 
+
theDBguy
post Feb 24 2012, 01:48 PM
Post #8

Access Wiki and Forums Moderator
Posts: 48,113
From: SoCal, USA



Hi Scot,

(IMG:style_emoticons/default/yw.gif)

Glad to hear you got it to work. Ace and I are happy to assist.

Good luck with your project.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 25th May 2013 - 06:19 PM