-
December 24th, 2012, 01:13 PM
#1
generating rollno and assing it to the textboxes in vb6 with ms-access
i m doing project in admission management system. i want to generate the rollno like 10cs01,10it01,10ee01...according to the department of the students where 10-year;cs,it,ee-dept;01-number.i need anyone to solve this prblm.thnks in advance.........
-
December 25th, 2012, 01:27 AM
#2
Re: generating rollno and assing it to the textboxes in vb6 with ms-access
Not enough info but sounds like you just need to combine some values into a string. How would depend partly on where the values are coming from and what form they are in.
Always use [code][/code] tags when posting code.
-
December 25th, 2012, 08:01 AM
#3
Re: generating rollno and assing it to the textboxes in vb6 with ms-access
when i enter the dept of the student it will search for the last rollno in the database and increment it by one then assign it in the text boxes.i want it to be generated automatically.......i ve the code like this but it ill generate the same rollno for all entries but i want it to be in order.
Code:
Static icount As Integer
icount = 0
If Combo1.Text = "BTECH-IT" Then
icount = icount + 1
rno.Text = "10IT" & icount
ElseIf Combo1.Text = "BE-AERO" Then
icount = icount + 1
rno.Text = "10AE" & icount
End If
-
December 25th, 2012, 10:26 AM
#4
Re: generating rollno and assing it to the textboxes in vb6 with ms-access
Well for one thing there you are incrementing the number in either case so you would be skipping numbers along the way. Assuming you weren't resetting it to 0 every time as you are. You should delete the line that sets the icount to 0. You should use 2 different counters in this case. You should also set the initial value of the count vars to that of the last roll in your database.
From the looks of it all of your items would get either "10AE 1" or "10IT 1"
Always use [code][/code] tags when posting code.
-
December 26th, 2012, 08:24 AM
#5
Re: generating rollno and assing it to the textboxes in vb6 with ms-access
thanks for ur reply.i dont know how to set the initial value of the count vars to that of the last rollno in the database.so ill u send me the code for that.if u send me the code then it ill be helpful for me to finish my project and also i need the code to validate the date field and email field.email field should satisfy the following condition:
(1) It is a must to have have only 1 @ and 1 or more . in the full e-mail
string since it is possible to have e-mail with more than one dot like
peter@student.edu.au
(2) @ must appear before .
-
December 26th, 2012, 12:35 PM
#6
Re: generating rollno and assing it to the textboxes in vb6 with ms-access
I could not provide the code even if I wanted to as you have not provided the info that would be required to do so.
That said it is far better that you try to write your own code and ask questions when you are stuck. If I or someone else writes it for you then you still would not know how or why it should be done that way.
Basically you have to lookup the data in the database and then set your starting value based on what you retrieved from the db, once you have that then you simply increment the value as needed.
Always use [code][/code] tags when posting code.
-
December 31st, 2012, 10:39 AM
#7
Re: generating rollno and assing it to the textboxes in vb6 with ms-access
to valid e-mail address which ill fufil the following primary conditions,i use the below code but it shows an invalid id if i try to give one @ symbol anywhere in the id.
conditions:
(1) It is a must to have have only 1 @ and 1 or more . in the full e-mail
string since it is possible to have e-mail with more than one dot like
peter@student.edu.au
(2) @ must appear before .
(3) Email like peter@student.edu. is an error although it
fufil (1) and (2) but it sorts of violates the e-mail syntax with only
a dot ending at the back
Code:
public Function CheckEmailAddy(Text as string) as Boolean
Dim intWhereAt as Integer
Dim intPeriod as Integer
intWhereAt = InStr(1, Text, "@")
intPeriod = InStr(1, Text, ".")
If intWhereAt > intPeriod then Exit Function
If intWhereAt > 0 And intPeriod > 0 then CheckEmailAddy = true
End Function
help me by correcting the code ..........
-
December 31st, 2012, 09:19 PM
#8
Re: generating rollno and assing it to the textboxes in vb6 with ms-access
It seems like you have moved on to a different question. Did you resolve the issue with the rollnumbers?
Always use [code][/code] tags when posting code.
-
January 1st, 2013, 09:20 AM
#9
Re: generating rollno and assing it to the textboxes in vb6 with ms-access
not yet .....
-
January 1st, 2013, 09:37 AM
#10
Re: generating rollno and assing it to the textboxes in vb6 with ms-access
You really should stay on the question you have started the thread for. As for the other question about validating email. You should do a search, there are many examples online related to validating email addresses in various ways.
Always use [code][/code] tags when posting code.
-
January 3rd, 2013, 12:08 PM
#11
Re: generating rollno and assing it to the textboxes in vb6 with ms-access
Thanks for your suggestion.now i got my email address validation part over...
-
January 6th, 2013, 06:08 AM
#12
Re: generating rollno and assing it to the textboxes in vb6 with ms-access
now i got the solution for my rollno generation query..
Code:
Dim rs As New ADODB.Recordset
If Combo1.Text = "BE-CSE" Then
strSQL = "Select Count(*) From biodata where dept=' " & Combo1.Text & " ' "
rs.Open strSQL, cn, adOpenKeyset, adLockReadOnly, adCmdText
If Not rs.BOF And Not rs.EOF Then
rno = "10cs" & rs.Fields(0).Value + 1
End If
rs.Close
Set rs = Nothing
ElseIf Combo1.Text = "BE-AERO" Then
strSQL = "Select Count(*) From biodata where dept=' " & Combo1.Text & " ' "
rs.Open strSQL, cn, adOpenKeyset, adLockReadOnly, adCmdText
If Not rs.BOF And Not rs.EOF Then
rno = "10AE" & rs.Fields(0).Value + 1
End If
rs.Close
Set rs = Nothing
-
January 6th, 2013, 04:43 PM
#13
Re: generating rollno and assing it to the textboxes in vb6 with ms-access
or, make a RS2 connection, as long as they are different.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|