Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 2nd, 2004, 10:35 AM
Authorized User
 
Join Date: Feb 2004
Location: london, uk, United Kingdom.
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default show the record number

Hello every one
I know its a silly question but if i want to have the current record number without using record navigation option what should i do

Best Regards,

Best Regards,
Hamed Gholamian
Reply With Quote
  #2 (permalink)  
Old April 2nd, 2004, 11:35 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Hamed, what do you mean by "want to have the current record number"? Do you mean that you want to know what the current record number is? Please clarify. Thanks.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
  #3 (permalink)  
Old April 2nd, 2004, 12:03 PM
Authorized User
 
Join Date: Feb 2004
Location: london, uk, United Kingdom.
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

First of all very thanks
ok i have a form like this (example)
1- john adams
2- Alan adams
3- Joe Adams

Current Record: 1

Name: John Adams
----------------------
Current Record: 3

Name: Joe Adams


As you see in above my current record: is my problem



Best Regards,
Hamed Gholamian
Reply With Quote
  #4 (permalink)  
Old April 2nd, 2004, 05:21 PM
Authorized User
 
Join Date: Sep 2003
Location: , , Canada.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I hope I understand this. Please flesh out your problem more clearly if I get this wrong.
The assumption is:

You want to open a form with the right data showing on the form for a specific person. You don't want to open a form and use the record navigation buttons on the bottom of the screen.

When you open the form you can choose parameters of the forms query back end. I'm assuming your form has its own record set if you use the navigation buttons.

Alot of assumptions

Change the action where you open the form using 1 of 2 techniques. Using the where or filter arguments of the openform command, or using the openargs argument. Look these up help if you need more information on how to use them (in Access Help). Here are some examples.
In the case where you have a query back end or recrodset for your form.
This will limit the value of the form you open to coincide with your customerID, substitute the appropriate name of your field. (using the where clause).


DoCmd.OpenForm "THE FORM YOU WANT TO OPEN", acNormal, ,"customerID = " & (the customer id) , ,


If you don't have a query based form you can use the openargs parameter (the next example)to pass whatever information you want to the for you are opening and then in your form_open method you can use something to look up all the data you might need.

DLookup() is a good example.


DoCmd.OpenForm "THE FORM YOU WANT TO OPEN", acNormal, , , , , (the customer id)

Roni Estein
Roni.Estein@e-drugscanada.com
https://www.e-drugsCanada.com
Reply With Quote
  #5 (permalink)  
Old April 3rd, 2004, 01:17 AM
Authorized User
 
Join Date: Feb 2004
Location: Edmonton, Alberta, Canada.
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I would suggest you display it as a caption of a label, in the example, with the name 'lblRecordnum, but you could make it a textbox with the locked property set true.

In the form current event:

Private Sub Form_Current()
    Me.LabelRecNo.Caption = Me.Recordset.AbsolutePosition
End Sub

If you make it a textbox that the user can type in, you can attempt to move the recordsetclone to the absolute position and if there is no error, set the form bookmark equal to the recordsetclone bookmark to move the form to the record and undo the texbox on error, all in the textbox afterupdate event. This is also functionality of the display textbox included with the default record navigation buttons.



Ciao
Jürgen Welz
Edmonton AB Canada
jwelz@hotmail.com
Reply With Quote
  #6 (permalink)  
Old April 3rd, 2004, 01:15 PM
Authorized User
 
Join Date: Feb 2004
Location: london, uk, United Kingdom.
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

First of all very thanks
ok i have a table like this (example)
record no | Name
----------|------------
1 | john adams
2 | Alan adams
3 | Joe Adams

I want to have text box to show me the current record number

Current Record: [u]1</u>

Name: John Adams
----------------------
Current Record: [u]3</u>

Name: Joe Adams


As you see in above my current record: is mt textbox

Best Regards,
Hamed Gholamian


Best Regards,
Hamed Gholamian
Reply With Quote
  #7 (permalink)  
Old April 4th, 2004, 04:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Melbourne, Vic, Australia.
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you have "record no" being the same as your "current record number", then you can just have the text box on the form.

However, if you want it to be something else, then you've got a bit of a problem.

Record numbers are completely arbitrary.
Say for example you have these values:
Apple
Banana
Carrot

In that order, you'd have Apple being record 1, Banana being Record 2, Carrot being record 3.

Sort that DESCENDING however, and you'd have Carrot being record 1 and Apple being record 3.

To make it more relevant to you - if you didn't have "record no" in your table, the "current record number" for "Joe Adams" could be anything, and mean nothing. It could be 1, it could be 2, or it could be 3.

So I say - just put a textbox for your "record no" field if you really have to have it.

I am a loud man with a very large hat. This means I am in charge
Reply With Quote
  #8 (permalink)  
Old April 4th, 2004, 07:03 PM
Authorized User
 
Join Date: Feb 2004
Location: london, uk, United Kingdom.
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear steven i completely undrestand your point but its hard to explain.
u know when you create a new form you have record navigation with record selector i.e. first next previous last and in the middle current record number which will tell you the current record number and its not relative to your table its just a number thats what i want


Best Regards,
Hamed Gholamian
Reply With Quote
  #9 (permalink)  
Old April 5th, 2004, 01:06 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Norwich, Norfolk, United Kingdom.
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hamad,

I have exactly the same requirement in an application I developed. I need a "record number". I found the best way was to have a "record number" field in the table (this can be in addition to, or instead of, the autonumber field). Create the record number - ie whatever you want it to be - at the time you create the record. Then everything will work out alright.

HTH
Clive

Clive Astley
Reply With Quote
  #10 (permalink)  
Old April 5th, 2004, 08:35 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Melbourne, Vic, Australia.
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, if it's a meaningless number you want, you could either have a REALLY meaningless number, by using the Rnd function, but that's probably not what you want.
Jurgen probably put you in the right direction more than any of the other posts.
Just change his label syntax to match a textbox, so you'll have something like:
Code:
Private Sub Form_Current()
    Me.YourTextBox = Me.Recordset.AbsolutePosition
End Sub

I am a loud man with a very large hat. This means I am in charge
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show number of records Vision G Access 2 June 3rd, 2006 03:01 AM
The last empty record in table should not show alie VB Databases Basics 4 March 9th, 2006 07:38 AM
Current Record Number Base VB How-To 1 December 7th, 2005 05:26 PM
WHy does it show 1 record per page instead of 10? gilgalbiblewheel Classic ASP Databases 2 April 27th, 2005 11:03 AM
show one record if there are duplication yylee Access 1 January 9th, 2005 05:57 AM



All times are GMT -4. The time now is 09:36 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.