?
Solved

Recordsource Macros

Posted on 2003-02-25
4
Medium Priority
?
216 Views
Last Modified: 2010-05-01
Hi, I'm just a beginner so this is probably a v.straightforward question sorry...!
I'm using VB to link to an Access db, I want to run a Macro by clicking on a command button. I've linked up the db using the Properties window, the Recordsource tab gives me an option to link a certain table but I want to link directly to the macro is this possible.....?
Do I still need to declare the connection in the code itself as well as connecting it in the properties window??
I hope this makes sense to somebody....

0
Comment
Question by:coppertop
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:dmang
ID: 8018025
You can declare and manage everything in code
0
 

Author Comment

by:coppertop
ID: 8024113
This is the Code I'm trying to use, can you give me any ideas as to what the problem is....??  The error I'm getting is
"The Microsoft Jet database Engine cannot find the input table or query 'Update Tables'. Make sure it exists and that its name is spelled correctly."


Private Sub UpdateTables_Click()

MsgBox "Update Tables?", vbYesNo + vbExclamation, "Confirm Update"

If No Then GoTo UpdateTables_Err

Else

Set AccessApp = New Access.Application

With AccessApp
    .OpenCurrentDatabase App.Path & "\\Fs1\9831363u\FYP\Class Lists etc.mdb"
Data1.RecordSource = "UpdateTables"

    ' Update 1st Year ID nos.
    DoCmd.OpenQuery "update", acNormal, acEdit
    ' Update 2nd Year ID nos.
    DoCmd.OpenQuery "update2", acNormal, acEdit
    ' Update 3rd Year ID nos.
    DoCmd.OpenQuery "update3", acNormal, acEdit
    ' Update 4th Year ID nos.
    DoCmd.OpenQuery "update4", acNormal, acEdit
    ' Insert 4th Year Class into Alumni
    DoCmd.OpenQuery "InsertAlumni", acNormal, acEdit
    ' Insert 3rd Year Class into 4th Year
    DoCmd.OpenQuery "Insert4th", acNormal, acEdit
    ' Insert 2nd Year Class into 3rd Year
    DoCmd.OpenQuery "Insert3rd", acNormal, acEdit
    ' Insert 1st Year Class into 2nd Year
    DoCmd.OpenQuery "Insert2nd", acNormal, acEdit
    ' Leave 1st Year Table blank for new students
    DoCmd.OpenQuery "delete1st", acNormal, acEdit

UpdateTables_Exit:
    Exit Sub
     
UpdateTables_Err:
    MsgBox Error$
    Resume UpdateTables_Exit

End With

End Sub

Any help would be gratefully accepted...! Thanks.
0
 
LVL 9

Accepted Solution

by:
dmang earned 150 total points
ID: 8025010
Looks like your database doe not contain a table object named "Update Tables"
0
 

Author Comment

by:coppertop
ID: 8025207
I got it sorted since using much simpler code, thanks for your help
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question