943,513 Members | Top Members by Rank

Ad:
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Jan 24th, 2009
0

Re: Case Sensitivity

you have done some mistakes in the code....do the modifications as I mentioned...

in the function definition change
rst.Open "select * from event where eventname='" & Trim(txtEName) & "'", gcn

to the following ...
rst.Open "select * from event where eventname='" & Trim(evtName) & "'", gcn

in your cmdAdd_click() change the entire code...like the following...

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub cmdAdd_Click()
  2. dim rst as New ADODB.Recordset
  3.  
  4. on error goto chec
  5.  
  6. If IsEventExists(txtEName.Text) = True Then
  7. MsgBox "Event Name Already Exist. Type a new one", vbInformation, "Duplicate Event"
  8. txtEName.SetFocus
  9. exit sub
  10. endif
  11.  
  12. rst.CursorLocation = adUseClient
  13. rst.CursorType = adOpenDynamic
  14. rst.LockType = adLockOptimistic
  15.  
  16. if rst.state=adstateopen then rst.close
  17. set rst=nothing
  18.  
  19. rst.open "select * from event",con,1,2
  20. rst.AddNew
  21.  
  22. rst!fnumber = StrConv(txtFNumber, vbProperCase)
  23. rst!eventname = StrConv(txtEName, vbProperCase)
  24. rst!fname = StrConv(txtFName, vbProperCase)
  25. rst!fincharge = StrConv(txtFIncharge, vbProperCase)
  26. rst!fschedules = StrConv(Text2, vbProperCase)
  27. rst!fschedulee = StrConv(Text3, vbProperCase)
  28. rst!sitcapacity = StrConv(txtCapacity, vbProperCase)
  29. rst!userschede = StrConv(Combo4, vbProperCase)
  30. rst!userscheds = StrConv(Combo3, vbProperCase)
  31. rst!fuser = StrConv(txtFUser, vbProperCase)
  32. rst!destination = StrConv(txtDestination, vbProperCase)
  33. rst!condition = StrConv(cboCondition, vbProperCase)
  34. rst!enddate = dtpDate(0).Value
  35. rst!startdate = dtpDate(0).Value
  36. rst!transaction = StrConv(cboTransaction, vbProperCase)
  37. rst!fsh = StrConv(txtfsh, vbProperCase)
  38. rst!ush = StrConv(txtush, vbProperCase)
  39.  
  40. rst.Update
  41. if rst.state=adstateopen then rst.close
  42. set rst=nothing
  43.  
  44. Label20.Caption = "Successfully Saved. . ."
  45. Call dload2
  46.  
  47. exit sub
  48.  
  49. chec:
  50. err.clear
  51. msgbox "some error occured..."
  52. txtEName.SetFocus
  53. exit sub
  54. End Sub

try this and get me your feed...

regards
Shouvik
Reputation Points: 30
Solved Threads: 49
Posting Pro
choudhuryshouvi is offline Offline
553 posts
since May 2007
Jan 24th, 2009
0

Re: Case Sensitivity

Click to Expand / Collapse  Quote originally posted by nagatron ...
Please help me how to ignore case sensitivity in VB. My program is to store data in the database, though I use small letters or big letters, the database store the data starting with a capital letter followed by small letters. Ex.

Input: Neil, neil, NEIL

In the database: Neil

So if I input Neil, the program response is ok but if I input neil or NEIL, the program results an error in the database and the program exits.

Please I need your kind help. Thank you so much.

Regards,
Neil
hi

try formatting the data before actually submitting it to the database initially... its been a fairly long time since i've done that much with formatting text in visual basic, so i'm not really sure if there's a default way to force name style capitalization of words, but either way... you could do it like this...

vb Syntax (Toggle Plain Text)
  1. Private Function PropperName(stDATA As String) as String
  2. 'holds returned word array, just incase ya know?
  3. Dim stWords() As String
  4. 'just a loop variable
  5. Dim iLoop As Integer
  6.  
  7. 'split the submitted data into individual words, after setting
  8. 'all characters to lower case
  9. stWords = getWords(LCase(stDATA))
  10. 'loop the words, set them the first character to upper case
  11. For iLoop = LBound(stWords) To UBound(stWords)
  12. Mid$(stWords(iLoop), 1, 1) = UCase$(Left$(stWords(iLoop), 1))
  13. Next iLoop
  14.  
  15. PropperName = Join(stWords, " ")
  16. End Function
  17.  
  18. Private Function getWords(stDATA) As String()
  19. getWords = Split(stDATA, " ", , vbTextCompare)
  20. End Function

keeping in mind that the getwords isn't really needed, but if your user enters the name NEIL NORBERT - for instance - then it would submit Neil Norbert to the database, vs Neil norbert

hope that helps

[edit]
ok, so i didn't notice the vbPropperCase in StrConv before :"> but this is a good way to do it if you don't want to use the built in way - lol
[/edit]
Last edited by kain_mcbride; Jan 24th, 2009 at 9:09 pm. Reason: ... explained... :P
Reputation Points: 22
Solved Threads: 3
Light Poster
kain_mcbride is offline Offline
25 posts
since Nov 2008
Jan 25th, 2009
0

Re: Case Sensitivity

Hello.......i have attached the sample code...
just check this out....and get me your feedback...

hope this will be useful for you...

regards
Shouvik
Attached Files
File Type: zip Sample.zip (12.2 KB, 14 views)
Reputation Points: 30
Solved Threads: 49
Posting Pro
choudhuryshouvi is offline Offline
553 posts
since May 2007
Jan 26th, 2009
0

Re: Case Sensitivity

hallo friend, I have tried your code about the case sensetivity. I works great but there's a little bit problem. If I input like this:

Input1:
Event Name: Fieldtrip --------------------> (primary key)
User: Neil
Schedule: 1/20/09

Input2:
Event Name: Tour --------------------> (primary key)
User: Neil
Schedule: 1/20/09

Where the event name is my primary key in the database. It results an error if "User" and "Schedule" in input1 and input2 are the same. I was expecting that there will be no error coz my primary key is "Event Name" not the user or schedule. "some error occured..." this message will appear. But if I input another entry in input2 like:

Input2:
Event Name: Tour --------------------> (primary key)
User: James
Schedule: 1/21/09

This works fine.
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
nagatron is offline Offline
99 posts
since Aug 2008
Jan 26th, 2009
0

Re: Case Sensitivity

By the way, thank you so much for the sample. I will give the feedback. I will try to study your code. As soon as I finished it, I will share the program to you if you want. It is for my thesis. hehehe thanks. . .
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
nagatron is offline Offline
99 posts
since Aug 2008
Jan 26th, 2009
0

Re: Case Sensitivity

These are the errors I see in the sample you sent to me. I was not able to view the running part. =) I will try to understand your code.
Attached Files
File Type: zip error.zip (113.6 KB, 11 views)
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
nagatron is offline Offline
99 posts
since Aug 2008
Jan 26th, 2009
0

Re: Case Sensitivity

Click to Expand / Collapse  Quote originally posted by nagatron ...
These are the errors I see in the sample you sent to me. I was not able to view the running part. =) I will try to understand your code.
what did you mean by this --->
Quote ...
I was not able to view the running part
did u mess up with vb???....it seems that some of your activex files (.ocx) are missing.....the snaps that you are attached are fully system related....these are not related to the program at all....to avoid getting this error you have the following options :-

1. uninstall and then re-install vb
2. just register "mscomctl.ocx" and "mscomct2.ocx" in your system...
might be you are not familer with registering activex controls manually...so i'm giving you the steps :-

1. if you haven't yet messed up with vb, you will have these two ocx files in your "system32" directory of your root drive..
2. use the command --> regsvr32 <ocx file name> to register the files...like to register "mscomctl.ocx" you must type....

regsvr32 mscomctl.ocx....similarly....for the other one
regsvr32 mscomct2.ocx..........issue this command from start->run

just register these two ocx files and the errors will be simultaneously solved....

if you donot have these files...just download from net....these are freely distributable and available for download...

regards
Shouvik
Reputation Points: 30
Solved Threads: 49
Posting Pro
choudhuryshouvi is offline Offline
553 posts
since May 2007
Jan 26th, 2009
0

Re: Case Sensitivity

Click to Expand / Collapse  Quote originally posted by nagatron ...
hallo friend, I have tried your code about the case sensetivity. I works great but there's a little bit problem. If I input like this:

Input1:
Event Name: Fieldtrip --------------------> (primary key)
User: Neil
Schedule: 1/20/09

Input2:
Event Name: Tour --------------------> (primary key)
User: Neil
Schedule: 1/20/09

Where the event name is my primary key in the database. It results an error if "User" and "Schedule" in input1 and input2 are the same. I was expecting that there will be no error coz my primary key is "Event Name" not the user or schedule. "some error occured..." this message will appear. But if I input another entry in input2 like:

Input2:
Event Name: Tour --------------------> (primary key)
User: James
Schedule: 1/21/09

This works fine.
can you upload your database(only) here...so that i can investigate.....according to the code...there is not a single line of error at all....i have tested it several times....but i tested it with a sample database....ofcourse your db structure is 100% diff. than this...so if you give me the actual database i can check for the error more thoroughly........now the choice is yours...

btw thanks for using the code and for urs feedback...

regards
Shouvik
Reputation Points: 30
Solved Threads: 49
Posting Pro
choudhuryshouvi is offline Offline
553 posts
since May 2007
Jan 26th, 2009
0

Re: Case Sensitivity

okk......check out this code now...
i think this time it is 100% OK...

regards
Shouvik
Attached Files
File Type: zip Sample.zip (12.5 KB, 9 views)
Reputation Points: 30
Solved Threads: 49
Posting Pro
choudhuryshouvi is offline Offline
553 posts
since May 2007
Jan 27th, 2009
0

Re: Case Sensitivity

sure, I will show it to you today. . .=) thank you =)
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
nagatron is offline Offline
99 posts
since Aug 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: How To Append Record In Flexgrid Control ( if any)
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Reservation System Help using VB 6





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC