Avatar billede gummimand Nybegynder
30. november 2009 - 11:36 Der er 12 kommentarer og
1 løsning

VBA for Access - Stored procedures - hvordan tilføjes de?

Jeg bruger Access som grænseflade. Bagved er en MS SQL Server.

I databasen har jeg oprettet en ny Stored Procedure; TestProc

I access vil jeg oprette en underformular, der henter sine data vha TestProc. Jeg bruger Guiden Underformular.

1. Jeg vælger "Anvend eksisterende tabeller og forespørgelser" (jeg går ud fra at forespørgelser er det samme som Stored Procedures)
2. Næste >
3. Her kommer problemet: Under "tabeller/forespørgelser" kan jeg ikke vælge TestProc.

Hvorledes tilføjer jeg TestProc til valgmulighederne?
Avatar billede terry Ekspert
30. november 2009 - 11:43 #1
queries and stored procedures are the same.

Are you working with MDB or ADP?


If its an MDB:
Why not make a view (query) in your SQL server and then LINK this into your Access db as you do with a tables.
Avatar billede terry Ekspert
30. november 2009 - 11:44 #2
Oops, (queries and stored procedures are NOT <<<<< the same)
Avatar billede gummimand Nybegynder
30. november 2009 - 11:50 #3
I am working with ADP
Avatar billede terry Ekspert
30. november 2009 - 12:14 #4
I'd better say its a while since I worked with ADP databases and then it was with Access 2000 which wasnt so good. Maybe its improved.

I know its possible to use a stored procedure as the record source to a form so I would have thought that you should be able to see it in the liast along with the tables and queries but I must admit I'm not 100% sure.

Although I say that stored procedures are NOT the same as quereies I know that they are in some ways similar.
Avatar billede terry Ekspert
30. november 2009 - 12:23 #5
Take a look at this link http://www.vb123.com/kb/index.html?200006_br_sp_adp.htm

In the section "Using stored procedures with forms" you will see that it states that stored procedures ARE NOT shown.
And a work-around is to make a view which returns the same dat as the stored procedure than use this in the wizard......

I'll let you read it for yourself.
Avatar billede hugopedersen Nybegynder
30. november 2009 - 12:24 #6
På formularens OnOpen event skriver du

Dim strSQL As String

strSQL = "EXEC stp_YourName"
Me.RecordSource = strSQL

Husk at sende dine parametre med.
Avatar billede terry Ekspert
30. november 2009 - 12:45 #7
Hi Hugo

But that wouldnt help in makeing the form with the form wizard would it? (To get the fields)
Avatar billede hugopedersen Nybegynder
30. november 2009 - 12:51 #8
Nej det har du ret i
Avatar billede hugopedersen Nybegynder
30. november 2009 - 12:52 #9
Men som der også står i det link du gav, så skal man lave et view der giver 'sample data' man kan bruge mens man opretter formen.
Avatar billede terry Ekspert
30. november 2009 - 13:02 #10
I seem to recall thats what we did to get the form up and running before going over to using the SP.

As I said its a while since I used ADP's
Avatar billede terry Ekspert
03. december 2009 - 14:41 #11
Hi gummimand
could you make use of the info in the link given Skrevet man. d. 30. november 2009 kl. 12:23:05| #5 ?
Avatar billede gummimand Nybegynder
26. januar 2010 - 12:25 #12
I have quited my job. I will never work again. No with Acces ...

Drop an answer and I give you points!

Thanks anyway
Avatar billede terry Ekspert
26. januar 2010 - 13:18 #13
Should I say sorry or congratulations on quitting your job?

Anything else lined up for the future?
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester