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

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
2 Pages V < 1 2  (Go to first unread post)
   Reply to this topicStart new topic
> Output Values In Stored Procedure?, Any Versions    
 
   
LilAnnCC1
post Nov 11 2019, 09:26 AM
Post#21



Posts: 849
Joined: 31-May 04
From: Wisconsin, USA


I went back and studied it some more. The NewID was staying so I added another variable lngID and changed the code to this:

CODE
With CurrentDb.QueryDefs("qPassR")
        .SQL = "EXEC spSalesCopy " & OldID & "," & strDate & "," & intTeam & ",1," & PO & "," & Store & "," & ShipTax & "," & ShipAddress
        With .OpenRecordset
          If Not (.BOF And .EOF) Then
            NewID = .Fields("ID")
            lngID = NewID  -------------------------------------this is what I added
          End If
          .Close
        End With
    End With
      
'Open to newly created
    With Forms("f_Sale")
      .Requery
      With .RecordsetClone
        .FindFirst "ID = " & lngID-------------------getting the lngID
        If Not .NoMatch Then
          Set Forms("f_Sale").Bookmark = .Bookmark
        End If
      End With
    End With
    DoCmd.Close acForm, "sf_SaleCopy"


It works wonderfully. Again, thank you so much!

--------------------
I am eternally grateful to all the people here who continually help get me out of jams!

Access 2010
Go to the top of the page
 
cheekybuddha
post Nov 11 2019, 10:10 AM
Post#22


UtterAccess Moderator
Posts: 11,888
Joined: 6-December 03
From: Telegraph Hill


I'm not sure why that is necessary, since you are just passing the value of NewID into another variable ...

...but if it works, then stick with it!!!

thumbup.gif

d

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


Regards,

David Marten
Go to the top of the page
 
LilAnnCC1
post Nov 11 2019, 10:18 AM
Post#23



Posts: 849
Joined: 31-May 04
From: Wisconsin, USA


Tested again. I can't get it to open using a recordset.


So I'm using:

'Open to newly created
DoCmd.Close acForm, "f_Sale"
DoCmd.OpenForm "f_Sale", , , , , , NewID (so I don't need the extra variable). It must have something to do with the way I set up the sales form. There is only 1 record on the sales form at all times, so that's maybe why it will only open to a new record.
DoCmd.Close acForm, "sf_SaleCopy"

--------------------
I am eternally grateful to all the people here who continually help get me out of jams!

Access 2010
Go to the top of the page
 
cheekybuddha
post Nov 11 2019, 11:34 AM
Post#24


UtterAccess Moderator
Posts: 11,888
Joined: 6-December 03
From: Telegraph Hill


Yeah, that makes more sense, since the form is using a filtered recordset.

One other way to try (but untested) is:
CODE
' ...
    With Forms("f_Sale")
      .Requery
      .Filter = "ID = " & NewID
      .FilterOn = True
    End With
' ...


but in the end it may just be easier to close and reopen the form.

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


Regards,

David Marten
Go to the top of the page
 
2 Pages V < 1 2


Custom Search


RSSSearch   Top   Lo-Fi    9th December 2019 - 03:31 AM