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
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?
I'll try and explain better. Here's the code I'm using. -
j = 2
-
strsql = "select * from scores order by RandNumber ""
-
Set rsscores = db.OpenRecordset(strsql)
-
Do While Not rsscores.EOF
-
DoCmd.GoToRecord acDataTable, "rsscores", acGoTo, j
-
SXFDA = rsscores("XFDANumber")
-
J = J + 2
-
rsscores.movenext
-
loop
-
there's other code but when I get to the docmd.goToRecord i get an error that rsscores isn't open
Use the recordset and FindNext: - strSQL = "select * from scores order by RandNumber"
-
Set rsscores = CurrentDb.OpenRecordset(strSQL)
-
If rsscores.RecordCount > 0 Then
-
J = 2
-
rsscores.MoveFirst
-
Do While Not rsscores.NoMatch
-
rsscores.FindNext "XFDANumber = " & SXFDA & ""
-
J = J + 2
-
Loop
-
End If
-
rsscores.Close
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.
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.
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.
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???
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.
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
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...
| |