Hi,everyone I am trying to develop a simple program that will register Users with the following requirements as reflected with the fields on the interface:
imgPassport.Picture ‘This is the Image for accepting Passport Size provided by the user
lblPicture_Name.Caption = "User's Passport Size" ‘This is the Label to display the Passport Size Name when loaded in the Image Box Control (imgPassport)
txtUser_Name.Text ‘The Name which User will be using to Login the System
cmbPrefix.Text ‘This is the User’s Prifix for Mr. , Mrs. , Miss or Something Like that
cmbPrivilege.Text ‘User’s access to the System ie, Administrator and User
txtPassword.Text ‘The desired Passsword
txtRetype_Password.Text ‘The Confirmatory Password
-->>
-->> I have a common dialog with the name : dlogPicture
-->> I have a Command Button (named cmdInsert_Picture ) which Uploads the Picture with the following codes:
Private Sub cmdInsert_Picture_Click()
Dim Picture_Path As String
On Error GoTo Extention_Error
With dlogPicture
.DialogTitle = "Select a Picture to Upload."
.Filter = "(*.bmp;*.jpg;*.gif;*.pcx)| *.bmp;*.jpg;*.gif;*.pcx|"
.ShowOpen
If .FileName <> "" Then
Picture_Path = .FileName ‘Nothing to do with this by now
imgPassport.Picture = LoadPicture(.FileTitle)
lblPicture_Name.Caption = .FileTitle
Picture_Name = .FileTitle ‘This is the Variable Declared in my module as public to hold Name of the Picture
Exit Sub
ElseIf .FileName = "" Then
imgPassport.Picture = LoadPicture(GetAppPath() & "\Pictures\Parand.JPG")’Default Picture
Exit Sub
End If
End With
Extention_Error:
MsgBox "Sorry the File has Unrecognised Extension,Extension must be .bmp; .jpg; .gif; and .pcx"
End Sub
-->> Now here comes an Error when I press my save Button with the foolowing code(named cmdSave):
Private Sub cmdSave_Click()
Call dbConnect ‘Declared in Module Level
‘The Error is on the Insert Line
Conn.Execute "INSERT INTO Ministers_AccountTB(User_Name,Password,Prefix,Privilege,Passport) VALUES ('" & txtUser_Name.Text & "','" & txtRetype_Password.Text & "','" & cmbPrefix.Text & "','" & cmbPrivilege.Text & "','" & Picture_Name & "')"
Conn.Close
Set Conn = Nothing
End Sub
-->> The Error Code I get is as Follows:
Run-time error ‘-2147217900(80040e14)’:
Syntax error in INSERT INTO statement.
-->>I don’t have a clue what Am I missing here,Help pliz.
Regards.
Bile
10
Newbie Poster
Recommended Answers
Jump to PostI believe that problem is Picture_Name.
You put Picture_Name in your insert statement but it never been declared in CmdSave.
Why you don't use lblPicture_Name? it hold picture name too.Conn.Execute "INSERT INTO Ministers_AccountTB(User_Name,Password,Prefix,Privilege,Passport) VALUES ('" & txtUser_Name.Text & "','" & txtRetype_Password.Text & "','" & cmbPrefix.Text & …
Jump to PostDim Picture_Path As String On Error GoTo Extention_Error With dlogPicture .DialogTitle = "Select a Picture to Upload." .Filter = "(*.bmp;*.jpg;*.gif;*.pcx)| *.bmp;*.jpg;*.gif;*.pcx|" .ShowOpen If .FileName <> "" Then Picture_Path = .FileName ‘Nothing to do with this by now imgPassport.Picture = LoadPicture(.FileTitle) lblPicture_Name.Caption = .FileTitle Picture_Name = .FileTitle ‘This …
Jump to PostPicture_Name as string
After you have declared the string, did you check if there is an actual file name returned? Use a simple messagebox to check...
msgbox Picture_Name If a value is returned, check all other values. Also check to see that your field in …
Jump to PostHad a look at your app, major problems there. let me correct most tomorrow morning (my time in hours), will post solution.:)
All 16 Replies
Jx_Man
987
Nearly a Senior Poster
Featured Poster
AndreRet
526
Senior Poster
Bile
10
Newbie Poster
AndreRet
526
Senior Poster
Bile
10
Newbie Poster
AndreRet
526
Senior Poster
Bile
10
Newbie Poster
AndreRet
526
Senior Poster
Bile
10
Newbie Poster
AndreRet
526
Senior Poster
dspnhn
10
Junior Poster in Training
AndreRet
526
Senior Poster
Bile
10
Newbie Poster
AndreRet
526
Senior Poster
Bile
10
Newbie Poster
AndreRet
526
Senior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.