View Full Version : Microsoft Access Visual Basic coding help
divx
Apr 8th, 2005, 06:10 PM
on access forms, at the bottom (status bar) display "Record 1 out of 10000", where is the 2 number variable stored in? I'd like to display that as a label on the main form, rather then looking at the small text at the bottom.
this is what I want to do, (not exactly as shown)
Page_Label.Caption = Current Record # + "Out of" + Total # of Records
the problem is I can't find the object of which those two variable are stored in, spent 2 days on msdn and no luck. Too bad Access only allow vb code, I'd rather use C#, C++, or Delphi
If anyone knows about Access and VB, your help is very much appreciated. Thank you.
ronny1980
Apr 8th, 2005, 07:47 PM
dude wrong forum
divx
Apr 8th, 2005, 07:59 PM
Oops, it suppose to be in OT
kingsley
Apr 8th, 2005, 08:15 PM
Wish I could help but without the code I can't do much.
guest10586
Apr 8th, 2005, 09:10 PM
Why don't you just make an autonumber in the table for the current record number in the form and do a count([autonumber]) to get the maximum number of records.
I used to be wicked at access but I haven't made anything in access in a while... I used to be able to do anything in it... Hope that helps.
blexann
Apr 8th, 2005, 11:05 PM
worst programming lanuage ever
chatbox
Apr 9th, 2005, 12:00 AM
You're looking at AbsolutePosition and RecordCount of a Recordset.
chatbox
Apr 9th, 2005, 12:01 AM
worst programming lanuage ever
LoL....please explain...?
blexann
Apr 9th, 2005, 12:29 AM
its a microsoft thing - if youve programmed in other languages u should know what i mean.
divx
Apr 9th, 2005, 01:37 AM
You're looking at AbsolutePosition and RecordCount of a Recordset.
AbsolutePosition and RecordCount are integer variables right? It can be accessed by Recordset.AbsolutePosition and Recordset.RecordCount?
does the object Recordset automatically recognize the currect data source? there is lots tables and quaries, it uses the current data source right?
So I would write as this
Page_Label.Caption = Recordset.AbsolutePosition + "Out of" + Recordset.RecordCount
currect? I won't be able to find out until monday, when i test it out at work :o
guest10586
Apr 9th, 2005, 02:00 AM
LoL....please explain...?
He can't seem to fatham any other language other then C or Java.... I hope you're not a computer nerd... Man, I swear those guys are weird..."Lynx and Macs are cool, Windows sux." :|
grant
Apr 9th, 2005, 04:49 AM
worst programming lanuage ever
He must be, to be making silly generalizations like that. Ignore him.
chatbox
Apr 9th, 2005, 05:11 AM
He can't seem to fatham any other language other then C or Java.... I hope you're not a computer nerd... Man, I swear those guys are weird..."Lynx and Macs are cool, Windows sux." :|
Not the nerdy type...just good (if I may say so) at it.
chatbox
Apr 9th, 2005, 05:18 AM
AbsolutePosition and RecordCount are integer variables right? It can be accessed by Recordset.AbsolutePosition and Recordset.RecordCount?
does the object Recordset automatically recognize the currect data source? there is lots tables and quaries, it uses the current data source right?
So I would write as this
Page_Label.Caption = Recordset.AbsolutePosition + "Out of" + Recordset.RecordCount
currect? I won't be able to find out until monday, when i test it out at work :o
Depending on how the form is designed. You'll need to grab the recordset that's in use within the form. Sometimes, you will see multiple recordsets within the same form by the use of different controls.
What you can do is this:
Add an action sub-routine for the form's Change (or whatever action, can't remember exactly)event, or form's Update, or form's RecordChange event...or something...
Have the routine read in the status bar text, check if the text is in the form of "xxx of xxx records", if so, then replace the text with what you want (and this will give you the two values that you need). This is probably an easier way to get what you want rather than dealing with recordset.
guest10586
Apr 9th, 2005, 05:27 AM
Not the nerdy type...just good (if I may say so) at it.
Not u, other dude.
blexann
Apr 9th, 2005, 09:19 PM
He must be, to be making silly generalizations like that. Ignore him.
Well that's your opinion I guess. I speak from experience what's your resume look like?
A professional programmer would almost never pick VB as their first choice. The reason why most (and I'm talking programmers here not the business crowd) use VB is it's sometimes the only choice at their place of work. There are very good alternatives - very elegant languages but unfortunately these alternatives are up against the massive ms marketing machine.
guest10586
Apr 9th, 2005, 09:54 PM
Well that's your opinion I guess. I speak from experience what's your resume look like?
A professional programmer would almost never pick VB as their first choice. The reason why most (and I'm talking programmers here not the business crowd) use VB is it's sometimes the only choice at their place of work. There are very good alternatives - very elegant languages but unfortunately these alternatives are up against the massive ms marketing machine.
vb does have its uses, made by ms or not. Don't say that one language is better then the other. It depends on the programs needs along with time and work as factors.
blexann
Apr 9th, 2005, 10:10 PM
vb does have its uses, made by ms or not. Don't say that one language is better then the other. It depends on the programs needs along with time and work as factors.
ok :)
divx
Apr 10th, 2005, 01:30 AM
Well that's your opinion I guess. I speak from experience what's your resume look like?
A professional programmer would almost never pick VB as their first choice. The reason why most (and I'm talking programmers here not the business crowd) use VB is it's sometimes the only choice at their place of work. There are very good alternatives - very elegant languages but unfortunately these alternatives are up against the massive ms marketing machine.
what do YOU suggest i do? with access, I can either use macro scripting lanaguage or vb, not like if I wanted to use vb if there is c# available. (also made by m$)
I learned vb as a gr11 course, delphi as a gr12 course, c# as university couse. Obviously I can do more with c# then vb.
kingsley
Apr 10th, 2005, 03:13 AM
VB is awesome. Such an easy language to program in. Just use VB for the high level GUI stuff and then use C for the low level stuff. Create .DLLs using C then get VB to call the functions. :cool:
divx
Apr 10th, 2005, 02:18 PM
Create .DLLs using C then get VB to call the functions. :cool:
hohoho, that's the way it's done. I wonder when will uni lecture me on how to write a dll
divx
Apr 11th, 2005, 10:07 AM
You're looking at AbsolutePosition and RecordCount of a Recordset.
yo chatbox, both variable contain nothing. When I set a break below that line, and check them for data, it says AbsoutePosition = Empty and RecordCount = Empty
danfromwaterloo
Apr 11th, 2005, 10:12 AM
Well that's your opinion I guess. I speak from experience what's your resume look like?
A professional programmer would almost never pick VB as their first choice. The reason why most (and I'm talking programmers here not the business crowd) use VB is it's sometimes the only choice at their place of work. There are very good alternatives - very elegant languages but unfortunately these alternatives are up against the massive ms marketing machine.
A professional programmer will look at the requirements of the project and determine which language is best suited for the development of the project. With the introduction of .NET, all MS languages now are on an equal footing wrt language scope and power. Granted, I prefer Java as I find it more "elegant" but that just as ridiculous as saying "Anybody who wants to speak, will speak English because its just so elegant..." All languages now are pretty much exactly the same. Personal preference is the big difference.
divx
Apr 11th, 2005, 10:52 AM
problem solved, found on msdn library
guest10586
Apr 11th, 2005, 10:56 AM
At least post the solution or link too it then. :P
divx
Apr 11th, 2005, 11:16 AM
ok solution is this, it's a 1 liner too :lol: took me a day to find this
Page_Label.Caption = "Page " & Form.Recordset.AbsolutePosition + 1 & " of " & Form.Recordset.RecordCount
figured out by using msdn tutorial as reference
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnima00/html/ima0077.asp
thanks for the help everyone
grant
Apr 11th, 2005, 12:14 PM
A professional programmer will look at the requirements of the project and determine which language is best suited for the development of the project.
and an amateur programmer generalizes "xxx language is the worst ever"...
danfromwaterloo
Apr 11th, 2005, 12:33 PM
and an amateur programmer generalizes "xxx language is the worst ever"...
Exactly. And as for the lines on your resume, it's not very hard to be fired from the best programming jobs on Earth....
I have my favourite languages, and at one time, I used to think they were the best languages too. I've matured in my view point, however. Give a person a hammer and everything looks like a nail; teach a person Java in university, and suddenly everything else looks passe.
divx
Apr 11th, 2005, 12:41 PM
with vb I can write spaghetti codes to save time, it's when I can use goto statement and not get yelled at by teacher/professor :cheesygri
danfromwaterloo
Apr 11th, 2005, 12:52 PM
with vb I can write spaghetti codes to save time, it's when I can use goto statement and not get yelled at by teacher/professor :cheesygri
Spagetti code is not a benefit of vb... ;)
blexann
Apr 11th, 2005, 01:53 PM
with vb I can write spaghetti codes to save time, it's when I can use goto statement and not get yelled at by teacher/professor :cheesygri
LOL
enough said!
divx
Apr 11th, 2005, 02:49 PM
Spagetti code is not a benefit of vb... ;)
the try...catch statement equvilient on c# to vb is the on Error Goto statement. We all know goto statement is the basis of spagetti codes.....
grant
Apr 11th, 2005, 03:10 PM
I have my favourite languages, and at one time, I used to think they were the best languages too. I've matured in my view point, however. Give a person a hammer and everything looks like a nail; teach a person Java in university, and suddenly everything else looks passe.
Getting off topic, i read on John Carmack's blog that he's been playing with java for mobile phones, and he thinks the performance is really poor, and it's not actually portable as claimed.
danfromwaterloo
Apr 11th, 2005, 03:41 PM
the try...catch statement equvilient on c# to vb is the on Error Goto statement. We all know goto statement is the basis of spagetti codes.....
^^^^ = hasn't seen VB.net
danfromwaterloo
Apr 11th, 2005, 03:42 PM
Getting off topic, i read on John Carmack's blog that he's been playing with java for mobile phones, and he thinks the performance is really poor, and it's not actually portable as claimed.
I have an LG4600, which runs J2ME...takes FOREVER to load simple games.
divx
Apr 11th, 2005, 06:25 PM
access form is messed up, it display fine on my 1600X1200 res LCD, but half of the form went missing on 1024X768 monitor. The form has the ability to resize, however I can't do that on the 10X7 res monitor for some reason. Sigh... another thing needs to figure out.