|
-
Feb 9th, 2010, 02:29 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Number loop
i want to loop the number like from 1 to 3 to 4 and so on if ever i save another record in the ms access,if its detect that there are no record in the ms access then it will show 1 which is ready to the new record and if its detected that there is a record then it should loop ex:there are 2 record in the ms access then it should be loop to 3 and so on..like if its detected that there are number-5 in the last record and the number-2 is deleted so it will be(number-1,number-3,number-4,number-5) then it will loop to 6..
any help will be appreciated
~[L!f3 !s @ll @ab0ut l3@rn!ng]~
~*D0nt Give up, h0pe is always present*~
-
Feb 9th, 2010, 03:32 PM
#2
Re: Number loop
I'm sorry but I don't understand.
-
Feb 9th, 2010, 11:36 PM
#3
Re: Number loop
 Originally Posted by MartinLiss
I'm sorry but I don't understand.
Me too.... 
@Condomx: If you are asking about unique numbers for your records in MS Access table, then try the AutoNumber type field. For more info, check the help file of MS Access.....
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Feb 10th, 2010, 09:56 PM
#4
Thread Starter
Hyperactive Member
Re: Number loop
oh ya i see..so here more details:
assume that i have a program which as a listview,add button(saving new record),delete button,edit button(update the record) and label1(Student-no<--this one will went to the next number if it is detected the number in the ms access like there is 1 in the ms access record set therefore it will went 2 and so on)...
O_O
~[L!f3 !s @ll @ab0ut l3@rn!ng]~
~*D0nt Give up, h0pe is always present*~
-
Feb 10th, 2010, 10:09 PM
#5
Re: Number loop
You need to query the DataBase and see how many records there are. You can then use that value as the upper bound.
Have a search for "rst.MoveNext" for some ball park examples.
-
Feb 11th, 2010, 06:58 AM
#6
Re: Number loop
Or,
You can store the last StudentID into somewhere(say, Settings table) and when you want to add new record(ie. new student), retrieve the last StudentID that we have stored in the Settings table, increment it's value by one, then display this value in the Label(or whatever you wish)....
When the new student details are saved into database, change the last studentID (in settings table) to the newly incremented one...! ...
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Feb 12th, 2010, 12:23 AM
#7
Thread Starter
Hyperactive Member
Re: Number loop
i mean autonumber in access..how to do that?
~[L!f3 !s @ll @ab0ut l3@rn!ng]~
~*D0nt Give up, h0pe is always present*~
-
Feb 12th, 2010, 01:20 AM
#8
Re: Number loop
You set that field's (within Access) Data Type to "AutoNumber".
BTW,
i mean autonumber in access..how to do that?
isn't even close to your original post!
-
Feb 12th, 2010, 09:02 AM
#9
Thread Starter
Hyperactive Member
~[L!f3 !s @ll @ab0ut l3@rn!ng]~
~*D0nt Give up, h0pe is always present*~
-
Feb 12th, 2010, 08:19 PM
#10
Re: Number loop
If your questions has been answered then you can now help us, by marking the thread Resolved. (see my signature block for directions).
-
Feb 13th, 2010, 07:23 PM
#11
Thread Starter
Hyperactive Member
Re: Number loop
i have the code below but the problem is when the ms access table is empty an annoying error occured like "type dismatch"
Code:
connection
rs.Open "configuration", con, 3, 3
If rs.RecordCount <> 0 Then
rs.MoveLast
setno = Right((rs("confignumber")), 4)
setno = Format(setno) + 1
setno.Caption = "configuration" & "-" & setno
Else
setno.Caption = "configuration" & "-" & 0
End If
rs.Close: Set rs = Nothing
con.Close: Set con = Nothing
if anyone out there knows how to fix this then please help me..im getting screw in this..
~[L!f3 !s @ll @ab0ut l3@rn!ng]~
~*D0nt Give up, h0pe is always present*~
-
Feb 13th, 2010, 08:10 PM
#12
Re: Number loop
Test for no records
Code:
rs.Open "configuration", con, 3, 3
If rs.EOF = False Then ' else no records
... do your stuff
End If
-
Feb 14th, 2010, 12:52 AM
#13
Thread Starter
Hyperactive Member
~[L!f3 !s @ll @ab0ut l3@rn!ng]~
~*D0nt Give up, h0pe is always present*~
-
Feb 14th, 2010, 01:46 AM
#14
Thread Starter
Hyperactive Member
Re: Number loop
oh thanks god my problem is solved in a big help of LaVolpe post...ty dude
~[L!f3 !s @ll @ab0ut l3@rn!ng]~
~*D0nt Give up, h0pe is always present*~
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
|