11. august 2000 - 14:09Der er
22 kommentarer og 2 løsninger
Hyperlinks til *.filtype i forespørgsel
Jeg ved det er muligt vha. hyperlinks at linke til dokumenter på vor server .. Vil det være muligt at angive en path, såvel som filtyper, som kriterier i en forespørgsel ? Altså, hvis path\'n angiver kundemappen og filtype angiver .doc, vil forespørgslen så kunne vise hyperlinks til alle dokumenter i & under den angivne path ?!?
I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
Public Sub ShowDir(Path As String) Dim FileName As String Dim FileNames(100) As String \'Bare for at have et par stykker Dim Counter As Integer
ChDir Path Counter = 0 FileName = Dir(\"*.*\") Do If FileName <> \"\" Then FileNames(Counter) = \"file:\\\\\" & Path & \"\\\" & FileName Counter = Counter + 1 FileName = Dir End If Loop Until ((FileName = \"\") Or (Counter = 100)) End Sub
Du skal slå op i hjælpefilen og se under \"rowsource function\".
Det er en speciel type funktion, som du kan indsætte i datafeltet \"RowSource\" i f.eks. en underformular i datasheet visning. Så skulle den være hjemme.
Du skal lukke et modul op, klikke F1, vælge knappen i hjælpeprogrammet, der på engelsk hedder \"... topics\".
Så får du en søgekasse og der skriver du ordene og så får du de forskellige afsnit med bl.a. programmering og sprog referencer, hvorunder denne specielle funktion er beskrevet.
Jeg kan ikke rumme hvordan jeg angiver resultatet af den overstående kode til at blive vist i en forespørgsel/underformular. Jeg har fattet at \"RowSource\" er \"postkilde\", men hvordan angiver jeg VBkode der ?
Ok, så tror jeg jeg har fattet det :) \'Rækkekildetype\' & \'Rækkekilde\' er kun aktuelle når vi snakker kombo-/listebox\'e right ? Ergo vil jeg kun kunne få vist de underliggende dokumenter i en angivet path sådan ?
Du skal skrive funktionens navn i feltet \"RækkekildeType\" og lade feltet \"Rækkekilde\" være tomt. Der skal ikke noget \"=\"-tegn foran funktionens navn i feltet.
Public Sub ShowDir(Path As String) Dim FileName As String Dim FileNames(100) As String \'Bare for at have et par stykker Dim Counter As Integer
ChDir Form![Mappeindhold]![Path] Counter = 0 FileName = Dir(\"*.*\") Do If FileName <> \"\" Then FileNames(Counter) = \"file:\\\\\" & Path & \"\\\" & FileName Counter = Counter + 1 FileName = Dir End If Loop Until ((FileName = \"\") Or (Counter = 100)) End Sub
Fugtigheden er nu ikke det værste. Det er meget værre, når massøsen rammer en øm ....fndaæs æh mhfh læf dsahljfdsalfdsaljk.... plet på ryggen. Så er det ikke til at koncentrere sig !!
Lige et udklip fra help filen:
The Visual Basic function you create must accept five arguments. The first argument must be declared as a control and the remaining arguments as Variants. The function itself must return a Variant.
Syntax
Function functionname(fld As Control, id As Variant, row As Variant, col As Variant, code As Variant) As Variant
The following are the five required arguments.
Argument Description
fld A control variable that refers to the list box or combo box being filled. id A unique value that identifies the control being filled; this is useful when you want to use the same user-defined function for more than one list box or combo box and must distinguish between them. (The example sets this variable to the value of the Timer function.) row The row being filled (zero-based). col The column being filled (zero-based). code A value that specifies the kind of information being requested.
Note Because Microsoft Access calls a list function several times to insert items into a list, often you must preserve information from call to call. The best way to do this is to use Static variables.
Microsoft Access calls the user-defined function repeatedly using different values in the code argument to specify the information it needs. The code argument can have the following values.
Code Meaning Function returns 0 Initialize Nonzero if the function can fill the list; False or Null otherwise. 1 Open Nonzero ID value if the function can fill the list; False or Null otherwise. 2 (Not used) 3 Number of rows Number of rows in the list (can be zero); -1 if unknown. 4 Number of columns Number of columns in the list (can\'t be zero); must match the property sheet value. 5 Column width Width (in twips) of the column specified by the col argument; or -1 to use the default width. 6 List entry List entry to be displayed in the row and column specified by the row and col arguments. 7 Format string Format string to be used to format the list entry displayed in the row and column specified by the row and col arguments; or Null to use the default format. 8 (Not used) 9 End (the last call to a list function always uses this value) Nothing. Microsoft Access calls your list function once for codes 0, 1, 3, and 4. It initializes the list function, opens the query, and determines the number of rows and columns. Microsoft Access calls your list function twice for code 5once to determine the total width of the list box or combo box and a second time to set the column width. The number of times your list function is called for codes 6 and 7 to get list entries and to format strings varies depending on the number of entries, the user\'s scrolling, and other factors.
Microsoft Access calls the list function for code 9 when the form is closed or each time the list box or combo box is queried. Whenever a particular value (such as the number of columns) is required, returning Null or any invalid value causes Microsoft Access to stop calling the list function with that code.
Tip You can use the Select Case code structure from the example as a template for your own RowSourceType user-defined functions.
Your user-defined function can use the numeric codes or the corresponding constants. Intrinsic constants have several advantages. They don\'t have to be loaded or declared, and they\'re more descriptive than the numeric codes. The following table lists the numeric codes and their corresponding intrinsic constants.
Som du ser, så skal funktionen være specificeret specielt. Access kalder denne funktion et utal af gange for at , initialisere, få oplysninger og til sidst for at hente værdierne i rækker og kolonner. En gang lavet, så har du en \"Smart Dims\" (lyder åndsvagt, hvis man læsper) til senere brug.
En anden ting jeg ikke kan rumme .. Den formular, jeg har udformet, til at vise resultaterne af denne funktion, har jeg sat til kun at blive vist som dataark. Alligevel bliver den vist i formularvisning ?!? Går jeg til designvinduet og derfra til formularvisning (via ikon), bliver den vist i dataarkvisning. Her er der en kombobox og når jeg prøver at åbne den, får jeg ugyldig funktion eller kompileringsfejl. Så noget må der være galt
Den funktion, som du skal lave skal overholde de regler, der er beskrevet i hjælpefilen ganske nøje.
Det gør du ikke.
Parametrene skal stemme overens, Det skal være en funktion - ikke en Sub ... osv.
Det dumme ved computere er, at de er så fandens nøjeregnende !!! De er fuldstændig ligeglade med udfaldet - MEN de er vandvittig hurtige til at blive ligeglade !!?!!
Lukker spørgsmålet af nød, har stadig ikke fået det til at virke :( men vil C på det ved lejlighed.
Synes godt om
Ny brugerNybegynder
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.