Jump to content
Sign in to follow this  
atomic98

Access

Recommended Posts

assalamulaikum...

rasa nya ramai sifu kat sini yg pakar access nih.

saya baru ja ..harap ada yg sudi bantu..

masalah nih dah cuba cri guna pakcik google ngan yahoo..

tak jumpa...(tak pandai guna Search sebenarnya).

ermm...

masalah yg nak tanya nih...

berkaitan ngan password...

coding.

contoh password yg dah ditetapkan coding:

If txtPassword = "projecta" And User = "Putra" Then

..................

..................

...................

Else

.................

.................

MsgBox "......................................"

End If

If Password = "projecta" And User = "Putra" Then

bahagian yg Bold tuh...

macam mana nak buat perbandingan melalui Table yg terdapat dalam Access.

contoh.

Nama Table: DataSulit

FieldName:User "aaa"

FieldName:Password "bbb"

macam mana nak tulis coding untuk password = password yang ada dalam table kat atas??

Harap faham soalan saya..

sekian terima kasih.

Share this post


Link to post
Share on other sites

ANtara coding yg pernah saya buat..

Function Checkpassword()


found = False
  myset.MoveFirst
  
  Do Until myset.EOF Or found = True
    If StrComp(myset!Login, Me.Login, 0) = False And StrComp(myset!Password, Me.Password, 0) = False Then
      MyUser = myset!Login
      found = True
    End If
  myset.MoveNext
  Loop
  
  
  If found = True Then
    HideAll
    Unload Me
    DoCmd.OpenForm "admin"
    DoCmd.Maximize
  Else
    MsgBox " Invalid Login or Password", vbExclamation, "Error"
       'If try = vbYes Then
    '    DoCmd.Close acForm, "Login"
    '
    'Else
    '    DoCmd.Close acForm, "login"
    End If
    try = try + 1
    If try > 3 Then
      DoCmd.close acForm, "Login"
      MsgBox " You do not have access to preform this command ", vbExclamation + vbOKOnly, "Access Deny"
      DoCmd.OpenForm "Front_page_frm"
      DoCmd.Maximize
     'End If
  End If
End Function

Ni dah lama saya buat.. anda boleh explore lagi

Share this post


Link to post
Share on other sites

found = False

myset.MoveFirst

Do Until myset.EOF Or found = True

If StrComp(myset!Login, Me.Login, 0) = False And StrComp(myset!Password, Me.Password, 0) = False Then

MyUser = myset!Login

found = True

End If

myset.MoveNext

Loop

terang bg jelas sikit boleh dak rangkap nih...

kurang la faham nya..

apa pun terima kasih sebab sudi juga nolong..

Share this post


Link to post
Share on other sites

tertinggal code ni

Private Sub Form_Load()
  try = 1
  Set MyBase = CurrentDb
  Set myset = MyBase.OpenRecordset("User", dbOpenDynaset)
End Sub

Create 1 table macam ni

user posted image

Dan form macam ni

user posted image

found = False

myset.MoveFirst

Do Until myset.EOF Or found = True

If StrComp(myset!Login, Me.Login, 0) = False And StrComp(myset!Password, Me.Password, 0) = False Then

MyUser = myset!Login

found = True

End If

myset.MoveNext

Loop

Berkenaan dgn code tu. Dia akan check username dgn password dari table yang kita buat. Samada valid atau tak.

Share this post


Link to post
Share on other sites

-start block loop-

If StrComp(myset!Login, Me.Login, 0) = False And StrComp(myset!Password, Me.Password, 0) = False Then

MyUser = myset!Login

-end block loop-

NAME

StrComp - Comparing strings

SYNOPSIS

StrComp(string1, string2[, compare_mode])

RETURN

-1 (string1 is less than string2)

0 (string1 is equal to string2)

1 (string1 is greater than string2)

# compare_mode

1) vbTextCompare

2) vbBinaryCompare

- cari kat google -

Expression StrComp(myset!Login, Me.Login) sama la dengan

# myset ~ current table

# Login ~ current data

# Me(yada2) takyah pun takpe "Login" tu biasa orang buat txtLogin.text

so... dia compare current data dgn Login(textbox)

begitu juga dgn section password

field "confirm", takyah pun takpe~ ikut camner tahap keselamatan dan kesistematikan

programming ko berkaitan dengan database. happy.gif huhu~

variable found??? elok la digunakan wat masa ni, heh~

found digunakan utk memastikan sessi login awak tu sempurna atau tidak~

dan.. selalunya orang akan simpan password dalam database yg dah encrypted.

cari la cara cara camner nak encrypt simple simple kat internet

contoh u dah buat satu function encrypt(string as string) as string

so, bila nak compare password yg user input. tak semestinya u kena keluarkan

password user dalam database lalu penat lelah decrypt dan compare dgn password

tersebut. so, cara yg tak penat dgn encrypt je passowrd user input tu dulu

lalu compare dgn password yg telah diencrypt dalam database. kiss. haha~

so, lebih kurang camni

... And StrComp(encrypt(myset!Password), Me.Password)

for beginner, programming is simple, don't make it any worse*

Nadia Ner~ LaLaLa~

Edited by raihan

Share this post


Link to post
Share on other sites

saja nak tanya kat penanya soklan jek... ada pa pe reason ngko tanak pakai built-in msaccess nye security module ke i.e. the .mdw?? kan pe.. sebab kalau ngko buat camtuh.. once orang tu leh masuk.. dia leh tengok sume table gak.. dan kalau dia connect to the mdb tak pakai ngko nye forms tuh sume.. dah tentu dapat tarik gak data tuh.. dan kalau ngko store password tuh unencrypted... dah tentu dapat sume password orang lain.. kalau msaccess nye built-in security leh set access macam2... e.g. leh certain table jek ke.. leh read-only jek ke.. etc..

Share this post


Link to post
Share on other sites

Trimas ridsnlan,raihan dan DeZeque.

Ridsclan, dah cuba la coding yg bg tuh...

tapi tak boleh pun...

kan event dia form_load..

tu yg kureng faham sikit tuh..

sbb selalu buat guna OK_Click()..

dah cuba, tapi ada ralat ..

cuba cari..tak tahu plak..kat mana ralat nya..

myebe tak faham kot..

kalau boleh bagi simple database yg Ridsclan buat tuh boleh..

sebab dah lama cari..ini first time tahu boleh buat...

send kat [email protected]

sekian terima kasih

Share this post


Link to post
Share on other sites

saja nak tanya kat penanya soklan jek... ada pa pe reason ngko tanak pakai built-in msaccess nye security module ke i.e. the .mdw?? kan pe.. sebab kalau ngko buat camtuh.. once orang tu leh masuk.. dia leh tengok sume table gak.. dan kalau dia connect to the mdb tak pakai ngko nye forms tuh sume.. dah tentu dapat tarik gak data tuh.. dan kalau ngko store password tuh unencrypted... dah tentu dapat sume password orang lain.. kalau msaccess nye built-in security leh set access macam2... e.g. leh certain table jek ke.. leh read-only jek ke.. etc..

Dulu pun dah guna tools access tuh untuk buat password...

tapi bila member tunjuk yg sotfware dia boleh [biskut tawar] password access terus malas nak guna... sebab tu cr cara lain plak..

"sebab kalau ngko buat camtuh.. once orang tu leh masuk.. dia leh tengok sume table gak.. dan kalau dia connect to the mdb tak pakai ngko nye forms tuh sume.. dah tentu dapat tarik gak data tuh".

ye ker? bak email..nanti sy send simple database dan awak cuba tarik data dari dia.... apa-apa pun trimas sebab sudi bg pandangan.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...