Støv, fibre og metalliske partikler kan påvirke både uptime, levetid og driftssikkerhed. Derfor arbejder flere datacentre systematisk med contamination control.
Du skal nok bruge DLookup, her er noget fra hjælpen
The DLookup function returns a single field value based on the information specified in criteria. Although criteria is an optional argument, if you don't supply a value for criteria, the DLookup function returns a random value in the domain.
If no record satisfies criteria or if domain contains no records, the DLookup function returns a Null.
If more than one field meets criteria, the DLookup function returns the first occurrence. You should specify criteria that will ensure that the field value returned by the DLookup function is unique. You may want to use a primary key value for your criteria, such as [EmployeeID] in the following example, to ensure that the DLookup function returns a unique value:
Dim varX As Variant varX = DLookup("[LastName]", "Employees", "[EmployeeID] = 1")
sub TjekLogin() Dim varX As Variant,varY as Variant varX = DLookup("[user]", "login", "[login] = " & loginTexstbox) if varX <> null then varX = DLookup("[password]", "login", "[password] = " & passwordTexstbox) if varY <> null then Msgbox " login og password godkendt" exit sub else Msgbox " password er IKKE godkendt" else Msgbox " login er IKKE godkendt" end if end sub
Kabbak kan ikke helt lige gennemskue din kode, men du sætter varX 2 gange det går i hvert fald ikke.......
sub TjekLogin() Dim varX As Variant,varY as Variant varX = DLookup("[user]", "login", "[login] = " & loginTexstbox) if varX <> null then varY = DLookup("[password]", "login", "[password] = " & passwordTexstbox) if varY <> null then Msgbox " login og password godkendt" exit sub else Msgbox " password er IKKE godkendt" else Msgbox " login er IKKE godkendt" end if end sub
Så har jeg lige et spg. DLookup hvad gør den ?
En anden løsning kunne være noget i den stil:
Refferencen : Microsoft DAO 3.51 eller 3.6
Dim ws As Workspace Dim db As Database Dim rs As Recordset Dim varLogin as boolean Set ws = Workspaces(0) Set db = ws.OpenDatabase(App.Path & "\dinDB.mdb") Set rs = db.OpenRecordset("SELECT * FROM login") If Not rs.EOF Then rs.MoveFirst Do While Not rs.EOF If rd!user = text1.text and rs!password = text2.text then varLoing = True exit do else: rs.MoveNext Loop End If If varLogin = True then msgbox("Login Acceptet"), vbOkOnly If varLogin = False then msgbox("Login Not Acceptet"), vbOkOnly
Det var et godt spg. men du kan ikke lave det du viser uden at dimme ws og db og rs og du kommer heller ikke uden om den reference, for eller så kender den ikke den connection type......
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.