Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
VB
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim str As String

Private Sub cmdclose_Click()
    Unload Me
End Sub
Private Sub cmdsave_Click()
rs.Fields("Registration_No").Value = regd_No.Text(this part says method or data member not found)
rs.Fields("Application_No").Value = form_no.Text
rs.Fields("Session").Value = Combo1.Text
rs.Fields("Admission_Date").Value = mskadmdt.Text
rs.Fields("Student_Name").Value = studentname.Text
rs.Fields("Class").Value = Combo2.Text
rs.Fields("Fathers_Name").Value = fname.Text
rs.Fields("Fathers_Mobile").Value = fmobile.Value
rs.Fields("Mothers_Name").Value = mname.Text
rs.Fields("Mothers_Mobile").Value = mmobile.Text
rs.Fields("Guardians_Name").Value = gname.Text
rs.Fields("Guardians_Mobile").Value = gmobile.Text
rs.Fields("DOB").Value = mskdob.Text
If Option1.Value = True Then
rs.Fields("Gender") = Option1.Caption
Else
rs.Fields("Gender") = Option2.Caption
End If
rs.Fields("Religion").Value = Combo3.Text
rs.Fields("Nationality") = Combo4.Caption
rs.Fields("Caste") = Combo5.Caption
rs.Fields("State").Value = Combo6.Text
rs.Fields("Permanent_Address").Value = address1.Text
rs.Fields("Present_Address").Value = address2.Text
rs.Fields("District").Value = district.Text
rs.Fields("Pincode").Value = pincode.Text
rs.Fields("Photo").Value = str
MsgBox "Data is saved successfully..!!!", vbInformation
rs.Update
End Sub

Private Sub Form_Load()
    con.Open "Provider=Microsoft.jet.OLEDB.4.0;Data source=E:\Tripura School Software - Copy\Record.mdb; Persist security info=False"
    rs.Open "select * from TM_REGISTRATION", con, adOpenDynamic, adLockPessimistic
      
End Sub
Sub display()
Textregd_No.Text = rs!Registration_No
Textform_No.Text = rs!Application_No
Combo1.Text = rs!Session
mskadmdt.Text = rs!Admission_Date
TextstudentName.Text = rs!Student_Name
Combo2.Text = rs!Class
Textfname = rs!Fathers_Name
Textfmobile = rs!Fathers_Mobile
Textmname = rs!Mothers_Name
Textmmobile = rs!Mothers_Mobile
Textgname = rs!Guardians_Name
Textgmobile = rs!Guardians_Mobile
mskdob.Text = rs!DOB
If rs!Gender = "Male" Then
Option1.Value = True
Else
Option2.Value = True
End If
Combo3.Text = rs!Religion
Combo4.Text = rs!Nationality
Combo5.Text = rs!Caste
Combo6.Text = rs!State
Textaddress1.Text = rs!Permanent_Address
Textaddress2.Text = rs!Present_Address
Textdistrict.Text = rs!district
Textpincode.Text = rs!pincode
Picture1.Picture = LoadPicture(rs!Photo)
End Sub

Private Sub searchbtn_Click()
rs.Close
rs.Open "Select * from TM_REGISTRATION where Registration_No='" + regd_No.Text + "'", con, adOpenDynamic, adLockPessimistic
If Not rs.EOF Then
display
reload
Else
MsgBox "Record Profile Not Found..!!", vbInformation
End If
End Sub

Private Sub uploadbtn_Click()
CommonDialog1.ShowOpen
CommonDialog1.Filter = "Jpeg|*.jpg"
str = CommonDialog1.FileName
Picture1.Picture = LoadPicture(str)
End Sub


What I have tried:

the linking process with ms access doesnt work,i guess,can anybody help me
When i click save button the error pops up
Posted
Updated 26-Apr-17 20:48pm
v3
Comments
David_Wimbley 27-Apr-17 2:30am    
This code dump isn't helpful. You also don't provide a clear enough explanation of your issue much less where in the code it could possibly be. You should remember we don't have acccess to your computer much less the ability to run your code.

I would suggest you narrow your code down to where the issue is and provide a clear and concise explanation of what your issue is, you'll get more useful feedback this way as right now there isn't much to go on.

1 solution

Give complete error message for help on your code.

Never build an SQL query by concatenating with user inputs, it is named "SQL injection", it is dangerous for your database and error prone.
A single quote in a name and your program crash. If a user input like "Brian O'Conner" can crash your app, it is an SQL injection vulnerability.
SQL injection - Wikipedia[^]
SQL Injection[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900