473,408 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

using the docmd.gotorecord command

489 256MB
I've been working on a problem and want to try using the docmd.gotorecord to get to a certain record in a table. I've got that figured out but I don't know what to do once i'm on the record. I want to select a usernumber from that record. It should be fairly easy to but I can't figure it out. Any help would be appreciated.
Thanks
Jan 23 '23 #1
9 5413
NeoPa
32,556 Expert Mod 16PB
CD Tom:
I want to select a usernumber from that record. It should be fairly easy to but I can't figure it out.
Do you mean you want to make the Control that's bound to the usernumber Field be selected as where the cursor is? If so, all the data selected or just the insert position added in there after the data?
Jan 23 '23 #2
CD Tom
489 256MB
I'll try and explain better. Here's the code I'm using.
Expand|Select|Wrap|Line Numbers
  1.     j = 2
  2.  strsql = "select * from scores order by RandNumber ""
  3.     Set rsscores = db.OpenRecordset(strsql)
  4.     Do While Not rsscores.EOF
  5.             DoCmd.GoToRecord acDataTable, "rsscores", acGoTo, j
  6.             SXFDA = rsscores("XFDANumber")
  7. J = J + 2
  8. rsscores.movenext
  9. loop
  10.  
there's other code but when I get to the docmd.goToRecord i get an error that rsscores isn't open
Jan 24 '23 #3
cactusdata
214 Expert 128KB
Use the recordset and FindNext:

Expand|Select|Wrap|Line Numbers
  1. strSQL = "select * from scores order by RandNumber"
  2. Set rsscores = CurrentDb.OpenRecordset(strSQL)
  3. If rsscores.RecordCount > 0 Then
  4.    J = 2
  5.    rsscores.MoveFirst
  6.    Do While Not rsscores.NoMatch
  7.       rsscores.FindNext "XFDANumber = " & SXFDA & ""
  8.       J = J + 2
  9.    Loop
  10. End If
  11. rsscores.Close
Jan 25 '23 #4
NeoPa
32,556 Expert Mod 16PB
Hi Tom.

Certainly there are Methods that you can (should) use when working with recordsets, which are quite different from what DoCmd and all it's Methods will give you. DoCmd typically works as an imitator of the human operator (In this case, takes you to a record on whatever (Form/Report/Datasheet) object is currently selected within the Access session.) whereas Methods of other objects help utilise those particular items. Generally it's preferable to use the latter where possible.

However, your question seems to imply (Correct me if I have this wrong.) that, for unstated reasons, you would actually like to use DoCmd specifically. If it's for manipulating a code recordset, IE. One that is not available to the operator directly - then you're out of luck I'm afraid. It only works as a way to work with items that are human-interfaceable.

I hope that makes sense.
Jan 25 '23 #5
NeoPa
32,556 Expert Mod 16PB
I have a rule of thumb that says use DoCmd when, and only when, there is no Method or Property that can work more directly with that which you're working with. It's a last-resort. It can be very helpful & important, especially where the interface doesn't provide a way to do it using the object model as defined. Otherwise though - I avoid it.
Jan 25 '23 #6
CD Tom
489 256MB
What i'm trying to do is get the XFDAnumber from the 2nd record in the file, I will then update that number into another file in record 1 then get the 4th record and put that into record 3 of the other file and so on.
Don't know if that makes sense or not.
Jan 25 '23 #7
CD Tom
489 256MB
NeoPa
I'm still working on the problem with the runners and not matching them up with the same person. I thought if I could put the runners number in a file and put the runners number they are match with that way I will have a place to look to see if that runner has ever been matched with that runner and if so select a different runner.
Does that sound like it might work???
Jan 25 '23 #8
NeoPa
32,556 Expert Mod 16PB
CD Tom:
Don't know if that makes sense or not.
Very little. The natural lack of clear explanation is exacerbated by the use of many terms out of place. What strikes me as most important though (I can & do get past such shortcomings regularly.) is that there is no reference at all to the points I'd raised. You simply haven't dealt with them and that leaves me somewhere before first base.
Jan 25 '23 #9
NeoPa
32,556 Expert Mod 16PB
CD Tom:
Does that sound like it might work???
I don't mean to sound snippy here but that may as well be in Mandarin (Not the orange). You ask a question about using DoCmd, and the next thing I know you're explaining something based on the internals of your particular database.

I do still want to help, but you need to communicate in such a way that someone reading has an idea of what you want.

As I mentioned before - when I post something in response it will always be hard for me to proceed unless you read and respond to that. Simply skipping over/past it is very confusing to someone in my position. Have you understood what I posted? Do I need to post the same again? If you really must jump around onto different subjects then a new thread would generally be required.
Jan 25 '23 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Eric | last post by:
What's the best way to cancel the new record when doCmd.GoToRecord , , acNewRec is executed and before the new record is actually written to the database. I'm maintaining an existing Access 97...
1
by: STeve Lefevre | last post by:
Hey folks -- I'm using the DoCmd.GoToRecord , , acNext to jump to the next record after the user enters a value. The problem is, it throws an error if it's already on the last record! What's the...
0
by: Timppa | last post by:
Hi, I'm converting ACCESS 2000 database to SQL Server. I have .adp project. In the .mdb I have form where I'll insert rows into two different tables using docmd.GoToRecod ,,acNewRec. In .adp...
5
by: Stack | last post by:
Hello, I have my data sorted on date desc in my form (multiple recs/table style). When I want to insert a new record (with my self made button and vba code(DoCmd.GoToRecord , , acNewRec)) the...
1
by: vostrixos | last post by:
Hi all,i need some help I'm working on a access project were i use a lot the docmd.gotorecord ,,next ..first ..last method and i use only once the DoCmd.GoToRecord , , acNewRec.Everything was...
2
by: vostrixos | last post by:
Hi I can't make a code work.What i do is that i'm creating a fileDialog object and later in the same function i use a Docmd.GoToRecord.I've notice that after i use the '.show' property within the...
3
martintallett
by: martintallett | last post by:
Help! I am trying to replace the Access Find button functionality on an old database. I can make it work when I use a basic form with bound fields and a button which shows a popup form which...
2
by: aaronyoung | last post by:
I have been using this forum to answer many questions regarding an Access database I am building (my first attempt at something like this - teaching myself as I go), and I've always been able to find...
0
by: Ben Lahoy | last post by:
Hi! My problem is basically in a search modal window, where the user is allowed to make a selection on which option to take. After selecting an option and then giving the data to search, the...
5
by: neosam | last post by:
Hey all, I am not able to integrate these 2 actions in one command. What i am doing is... A button which sends a report with only specific data to a particular person (via outlook). I am able to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.