Trying to open the current db in Access 2010 through Access Basic

I haven't programmed in Access Basic in quite a long time.  Through Access 
Basic coding, I use to be able to open the current database and then open a 
table and walk through each record.  Now I can't even open the database.  
Does anybody have an example of how to do the following:
1) Open Workspace
2) Open Current Database (assume name is unknown during run time
3) Open specific table
4) Step through each record and access the fields

0
Utf
3/3/2010 1:37:02 AM
access.modulesdaovba 1670 articles. 0 followers. Follow

1 Replies
931 Views

Similar Articles

[PageSpeed] 10

George C. Derkacs <George C.
Derkacs@discussions.microsoft.com> wrote:

>I haven't programmed in Access Basic in quite a long time.  Through Access 
>Basic coding, I use to be able to open the current database and then open a 
>table and walk through each record.  Now I can't even open the database.  
>Does anybody have an example of how to do the following:
>1) Open Workspace
>2) Open Current Database (assume name is unknown during run time
>3) Open specific table
>4) Step through each record and access the fields


Is this the kind of thing you want to do?

Set db = OpenDatabase("full path\mydb.mdb")
Set rs = db.OpenRecordset("table")
Do Until rs.EOF
	'do something
	rs.MoveNext
Loop
rs.Close : Set rs = Nothing
db.Close : Set db = Nothing

BTW, it's been Visual Basic for Access since Access 95.  The
last (only?) Access Basic was in Access 2 and, while that
was a very good version, it's more than long in the tooth
(like me) now ;-)

-- 
Marsh
MVP [MS Access]
0
Marshall
3/3/2010 4:45:24 AM
Reply:

Similar Artilces:

trying this out
This is a test posting. On Tue, 13 Nov 2007 16:06:51 +0800, "hmmmm" <bobo123@dotdot.dyndns.org> wrote: >This is a test posting. > Please use microsoft.public.test or microsoft.public.test.here for your testing. This is a working newsgroup. If you have questions about an Access database, please post them. John W. Vinson [MVP] ...

SQL report as dashboard to filter for Current user cannot user CRMAF_
First off I cannot use the default filters because the report is being generated for a dashboard and not a CRM Report, however it is being created via an SRS Report. I simply need a way to filter the report for the current user only, I found this query which gives the system user but this will not match up to the Account owner because of its format. select fullname from FilteredSystemUser where domainname = SUSER_SNAME() Gives: CRM Admin I need, Admin, CRM ...

How to change default 'Files of Type' to open only .pub files
Is there a setting in the registry or elsewhere so that when I File-Open I only get .pub files & not have it default to Files of Type "All Publisher Files"? It takes a long time for it to find all the files with various extensions. PUB files are all I want. -- T.G. Lambini Create a folder in My Documents, name it Publisher or whatever, Open options in Publisher, general tab, click the publication line, click modify... browse to the folder where you want Publisher documents to go. Drag all your Publisher documents to this folder. -- Mary Sauer MSFT MVP http://office.mi...

How do I prevent "Help" from opening when I open Excel?
Whenever I open Excel 2003 the Help feature opens on the right. How do I pevent this? I only want Excel to open with a new sheet. -- Lee P Lee Help or TaskPane. For Help, you should be able to close it using the "x" and next time open Excel should not display. If TaskPane, go to Tools>Options>View and uncheck "Startup Task Pane" Gord Dibben Excel MVP On Mon, 12 Dec 2005 13:05:29 -0800, "Lee P" <LeeP@discussions.microsoft.com> wrote: >Whenever I open Excel 2003 the Help feature opens on the right. >How do I pevent this? I only want Exce...

I am trying to round up to the nearest 25 cents
I am trying to round a money value to the nearsest 25 cents and it keeps rounding to the nearest dollar HELP Try =CEILING(A1, 0.25) In article <2DB8F007-1E27-4A48-923B-C7D4D0238B5E@microsoft.com>, sypher <sypher@discussions.microsoft.com> wrote: > I am trying to round a money value to the nearsest 25 cents and it keeps > rounding to the nearest dollar HELP =ROUND(A1*4,0)/4 -- HTH Bob Phillips "sypher" <sypher@discussions.microsoft.com> wrote in message news:2DB8F007-1E27-4A48-923B-C7D4D0238B5E@microsoft.com... > I am trying to round a mone...

Trying to clear up Received but not invoiced report
I am trying to clean up the received not invoiced items. The problem began with entering a purchase order and then not matching the invoice to the items received agaisnt the purchase order. SO we thought that doing a returned transaction entery would solve the problem. The only thing is now the return shows up on our Received/ Not invoiced report. And the report is becoming a huge mess and difficult to use. What is the best way to clear up items that have been received but were not matched and already paid through the invoice entery? There is a knowledgebase article on this very thing av...

send/receive (2nd try)
New computer. Microsoft XP Home. Microsoft Office XP Small Business 2002. Earthlink dial-up account. Two e- mail accounts. After opening Outlook, 1st send/receive (option 3, all accounts) usually prompts for both passwords, downloads messages, all good. Next time, though, no prompt for account 2, error cannot connect to server, account 1 usually gets messages. Every five minute send/receive option eventually degenerates to cannot connect to server errors for both accounts. Meanwhile internet browsing slows to a crawl. Any ideas? ...

How do I... On opening file from hard disk, open a form
Hello, Microsoft Access 2003. I would like my Main Menu form to open when a user opens my database. So far I am in no way networked or web based, I'll probably get there but right now I have a file (Inventoryv4.mdb) that resides on the user's hard drive. when she opens this file, I would like my main menu form to open, instead of her having to go through the little task pane and dbl clk on frm_MAINMENU. How might one do this? ***Note: I need the task pane with all the tables queries, forms etc to still be there, just in the background, preferably minimized, and the main men...

How to send email after entry from data access page
I hope this is an easy one, but i am not a programmer. I got volunteered for this because i built an inventory database. Access 2003I have a simple referral table that i have linked to an "Input" page for people to enter records (including a drop down list of email addresses). And an "Output" page where pepole can come and edit. That part seems to be working fine.I need to have an email sent out when a new record is posted. Ideally, i would like it to be sent out based on who is selected in that email list, but i would settle for anything at this point.Thank you in adv...

owa cant open ppt attachments
i have an exchange 2003 cluster when a user tries to open or save a powerpoint attachment it hangs at 97% all other attachments open fine any ideas thanks ...

How do I cancel a msg Outlook keeps trying to send unsuccessfully?
How do I cancel an "in process" email Outlook keeps trying to send unsuccessfully due to a huge email message I tried to send with way too many attachments? It's stuck in "send" mode, and as a result, I can't send any emails because Outlook cannot get past trying to send this message. How do I cancel a pending outbox transmission while it's trying to send? I've tried everything I can think of to no avail. Please help! Angelczech wrote on Fri, 12 March 2010 07:32 > How do I cancel an "in process" email Outlook keeps trying to send ...

Accessing pst file: administrator permission
I've been trying to access a pst file I saved to disk, but when I try to uncheck the 'Read only' box in file properties (which I presume is what's stopping me accessing the file), I keep getting the message: 'You will need to provide administrator permission to change these attributes'. Any ideas of how I do this? Thanks Apparently your Windows Vista/7 workstation doesn't see you logged on with local administrator rights and/or you don't have full access rights to the file in question. Are you logging on with local administrator rights? &qu...

Opening other peoples mailbox
I have exchange 2000 and exchange 2003. When I move a mailbox to exchange 2003, I no longer can open that particulare mailbox in outlook. I am an administrator in exchage, and in exchage 2000, I could add a persons mailbox to my folder list and view all of their folders. The error I get in outlook is "Unable to display the folder. Microsoft office outlook could not access the specified folder location." I also have noticed when I go into E-mail accounts in outlook 2003, on the Advanced Tab under "open these additional mailboxes", the mailboxes on Exchange 200...

Publisher 2002 on Win98
Dear all, Situation: Upgrade of Publisher to 2002 on Windows 98 (to take advantage of compression etc). Save Publisher files (doesn't matter what format) on another machine which uses Windows XP with Publisher 2002. Note: the two machines are different operating systems only. Open files on Windows 98 with Publisher 2002. It takes a little while and then crashes asking me if I want to restart. The safe mode option doesn't help. The details are quite long (and I cannot select them anyway). But The main error message displays: AppName: mspub.exe AppVer: 10.0.4128.0 ModName:mso.d...

trying to insert a 0 in front of zipcode
Hello, I do not use excel at all so i have no clue! I have a list of daycares that i want to create mailing labels with...about 700 of them but the problem is my zipcode column there needs to be a zero in front of all 700 zipcodes how to i insert a zero in front of them without having to type it into each box? the other question is can i print labels directly from excel or do i have to go thru ms word? thanks Greg One of these 1) format the cells with custom format 00000 2) format the cells with Special / Zip Codes 3) format the cells as Text 4) begin all zip codes with an sin...

OL2002 won't open when clicking on web links
I have WinXP home ed., Office XP small bus. ed., with outlook 2002. It was working fine but now when I click on a link on a web page I get a message saying "cannot open microsoft outlook. can't create item." I tried reinstalling officeXP and also went into file associations and made sure the URLmailto was associated with outlook. In IE 6.0 it does show outlook as being the default mail client. Email me if you can help! Thanks! ...

access 11-19-04
hi, i'm maxchen ljojoi "����׿" <maxchen124@hotmail.com> д����Ϣ���� :eXutLfezEHA.3236@TK2MSFTNGP15.phx.gbl... > hi, i'm maxchen > > �㷽���𣿳���ˬ��Ӵ�� "����׿" <maxchen124@hotmail.com> д����Ϣ���� :eXutLfezEHA.3236@TK2MSFTNGP15.phx.gbl... > hi, i'm maxchen > > ...

When Outlook 2003 Opens...Word Opens
Hi, Every time I open Outlook 2003 on my XP Pro machine it also opens Microsoft Word...and a tray icon says "outlook is synchronizing folders". How do I stop Word from launching? Thanks in advance, Paul Don't set Word as your e-mail editor in Tools-> Options-> tab Mail Format -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the Outlook Icons Mean? -Create an Office 2003 CD slipstreamed with Service Pack 1 ----- "Paul Reed" <prreed@jacksonreed.com> wrote in message news:ugty1In9EHA.3336@TK2MSFTNGP11.phx.gbl... &...

How can I batch open a txt file in excel 2003 and save back as a .
I have about 3000 .txt files I need to open in excel and just save them. Is there a way I can batch run these? It would involve opening the txt file and saving it as the same name. Try this macro. Change "MyFolder" to the actual path. To use, open up a new workbook, press ALT+F11, go to Insert > Module, and paste in the code. Press ALT+Q, go to Tools > Macro > Macros and run it. Sub ChangeXLS() 'Constructive criticism from VBA programmers appreciated Dim MyFolder As String Dim NewName As String Dim OldName As String Dim patharray As Variant MyFolder = "C:\P...

access-problem saving forms and reports
I have a problem every time im trying to save a form in access. It doesnt matter to what table i create a form or a report,the access wont allow me to save it and puts on an error message: "microsoft office access doesnt have the option to save the form or the report because he presents chars from a language that cannot be be saved in your system area. switch your system area to the language in the form or the report and than try again". my office is in hebrew and my windows in english,i have passed all the data in the table and in the form between the languages back and fort...

error message when trying to install WMP 10 or 11
My operating system is Windows XP Home Edition 2002. I'm trying to download either WMP 10 or 11 and I get a message saying it was not possible to complete setup, see webhelp for more assistance, however there is no additional information when I click Web help. the Error message is 8007F0DA. Can anyone help me? Thanks. On Tue, 30 Mar 2010 07:54:01 -0700, Nate <Nate@discussions.microsoft.com> wrote: > >My operating system is Windows XP Home Edition 2002. I'm trying to download >either WMP 10 or 11 and I get a message saying it was not possible to &g...

outlook wont open
i recently performed an update on office 2000. ever since outlook will open once but if you close it it wont come back up you can select the icon but it doesnt repsond. if you go to the task manager it says outlook.exe is running? any one have any suggestions it would be greatly appreciated its my boss' computer. ...

I cannot open Organize, what can I do?
I am rying to organize my emails by colors but i cannot open the organize option. It never highlights, nomatter what i do. I downloaded the testversion of Office 2003 from the MIcrosoft website, could this be why i cannot open this option? If anyone has any idea, please let me know. Thanks in advance ...

Help! Help content lost (links to 2010?)
When I try to get online Help from Word, I see a page which has the new Office logo for 2010. The framework for Help is provided, but there is no content under any of the headings. ("No results available"). This was from a VBA page, so I was seeking Word Developer help. If I right-click the title "Word Developer Help" and paste the URL property, I get: http://office2010.microsoft.com/client/helphome.aspx?lcid=3081&NS=WINWORD%2EDEV&Version=12 But I'm running Office 2007. I also have Office 2003 installed. How can I get help for Word 2007? Fur...

Try or TRY
Hello, Will there be any opitmization or ... when we use INT or TRY macros instead of int or try ? Which one is better to be used? Thanks, JSmith "JSmith" <jsmithmitra@yahoo.com> wrote in message news:%23G1sOVdoEHA.692@TK2MSFTNGP12.phx.gbl... > > Hello, > > Will there be any opitmization or ... when we use INT or TRY macros instead > of int or try ? Which one is better to be used? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_exceptions.3a_.converting_from_mfc_exception_macros.asp -- Jeff Partch [VC++ MVP] FYI, TRY ...