|
We are using MS Access Database. Is it possible to execute a macro in the access database from VC++ program. My macro consists of several sqls. I understand you could do CDaoQueryDef to execute sqls, but my macro also has a transfer text that imports a txt file and creates a table in the database. I want to know if it is possible to directly execute the macro from the program. Any suggestions or ideas would be greatly appreciated.
Thanks,
|
|
|
|
|
Is Imposible, to do that, but you can try to execute the macro from a Query into the Access database, and in that case, you can execute the query...
Cheers!!!
Carlos Antollini.
|
|
|
|
|
Are you saying that I create a Query in Access database to execute the Macro. If that is what you are saying, how do I do that. When I create a new query within access database, it doesn't even give me an option to include a macro. Please advise.
Thanks,
|
|
|
|
|
Yes, I don't Know How you can execute a Macro from a Query, but is true that you can not execute a Access Macro from VC++. I am not an expert in Access, but I think that you need to execute the macro from the Query.
But at this moment I have an Idea: You can execute the macro with OleAutomation. I think that this last one is the best...
Cheers!!!
Carlos Antollini.
|
|
|
|
|
I don't know a whole lot about OleAutomation. Would you direct me to some place where I can find sample code.
Thanks,
|
|
|
|
|
You can see into the MSDN
Q192348. This Article, have a sample of AleAutomation with Excel
You can make the same with Access.
Cheers!!!
Carlos Antollini.
|
|
|
|
|
Here's what you can do from VB
Private Sub Form_Load()
Access.OpenCurrentDatabase ("f:\Dev\test.mdb")
Access.DoCmd.RunMacro "ExportAll"
Unload Form1
End Sub
|
|
|
|
|
If I were to use VBScript would the code be the same as above.
Thanks,
|
|
|
|
|
As Carlos has already pointed out you have to use OLE automation to do this. It's very important to keep in mind that MS Access is *not* a database - it's an application that implements an user interface to the Jet database. You can use the Jet database from VC++ through any of the technologies in MDAC - DAO, OLE DB, ADO, ODBC. But MS Access implements a number of features that makes your everyday use of the Jet database easier. This includes a query designer, a report generator and a macro facility. However, these functionalities belong to the Access application and *not* to the Jet database. AFAIK Access stores the these things in the Jet database as BLOB fields, but they are proprietary to Access and hence not accessible through the Jet connectivities.
But as you can with all the MS Office applications you can "remote control" Access through OLE automation. It does however require that the user has MS Access installed on the PC. The free Jet engine is not sufficient.
As Todd Smith has shown it is very easy to do automation from VB (ouch! I sad the word! I have to go and wash my mouth with soap;P )
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
I'm trying to popup a window just above the system tray ( like Microsoft Messenger does). Is there a way of finding out the system tray position. The best I've found so far is the SPI_GETWORKAREA parameter but this gives me the work area and not the position of the system tray.
Any ideas,
Michael
|
|
|
|
|
Look the Function SHAppBarMessage
You can get the position of TaskBar. With that position you can put your Dialog over the TaskBar.
You can see if your taskbar, is at left, Rigth, Tip or Bottom of your Screen.
Cheers!!!!
Carlos Antollini.
|
|
|
|
|
Hi,
I´m trying to change the bitmap image ( Shown in the right side) of a context menu, I have tried this, but don´t works, What I have made wrong ? ( _DeleteCommentBitmap is a member variable of the view, and it´s a CBitmap one)
pPopup->ModifyMenu( ID_WBS_POPUP_COMMENT, MF_BYCOMMAND, ID_WBS_POPUP_COMMENT,
&_DeleteCommentBitmap);
Thanks, Bye !
Braulio
|
|
|
|
|
Hello,
I have a dialog type app and I need to make my own Minimize button.. Does anyone have a sample of code that would allow someone to create their own minimize button?
Thanks,
Rob
|
|
|
|
|
Why do you need your own minimize button? Why not just capture the minimize button being clicked and do your own thing?
Michael
|
|
|
|
|
I have created a dialog type app that uses a bitmap for a background.. This allows me to create a non-rectangular dialog box (mine has rounded transparent corners and a nice skin/type look).. The problem is to do this I can't use a border on the dialog box nor can I use a title bar.. so I don't even have a minimize button on this dialog.. I need to make my own minimize button to minimize the app.
Thanks,
Rob
|
|
|
|
|
Okay. I see. Where do you want to put the minimize button? I assume you know how to minimize the window ( ShowWindow(SW_MINIMIZE) ).
Michael
|
|
|
|
|
I'm pretty new to programming and I don't even know where to start on the minimize process.. I want the app to minimize to the tray/system bar like most other apps do by default.. Minimizing the app by the system clock would be awesome but it would probably require a lot more code and I assume it would be much more difficult, so for the time being just minimizing to the tray/system bar would be fine.
Do you have sample code I could try?
Thanks for you help and fast responses!!!!
Rob
|
|
|
|
|
Never mind the CDialog::ShowWindow(SW_SHOWMINIMIZE); worked fine
Thanks!!
Rob
|
|
|
|
|
|
Hi!
I've been searching and lurking around here looking for ways to create a GUI.
It wasn't so easy to find info so I thought I'd confront you guys with questions that swirrel around in my head.
I had to test things and appended a VM_LBUTTONCLICK to my CVIEW.
in the code I had the following:
[CODE]
CDC *dc = this->GetDC();
dc->MoveTo(point);
CButton *knapp = new CButton();
CRect rect;
rect.bottom = point.y+20;
rect.top = point.y;
rect.left = point.x;
rect.right = point.x+50;
knapp->Create("test",BS_DEFPUSHBUTTON|WS_VISIBLE | WS_TABSTOP,rect,this->GetParent(),IDC_BUTTON_EXISTING_IN_ADIALOG);
[/CODE]
This did in turn create a button everywhere I pressed the left mousebutton.
Fair enough;
What I need now is an action beeing performed on pressing that button. For instance MessageBox("some message");
Say I placed the code somewhere ELSE, in OnInitialUpdate() forinstance. Creating only one button.
Would this be a BAD and HARD way to create a GUI? Say that I would like editbox'es and stuff.
(PS: anyone know of a tutorial on how to create a GUI?)
In advance thanks, you're all great resources!
|
|
|
|
|
Can't you not use a CFormView and create your controls on the dialog resource?
Michael
|
|
|
|
|
Yeah well..
You know what?!
That idea.. You can just.. stuff it up.. hmm.. maybe..
Guess it wasn't quite so dumb afterall :P
I might just do exactly that!
Thanks man! =)
I O U 1! =)
"You know you're drunk when you can't even lie still on the floor without holding on to the floor"
|
|
|
|
|
Hi !
I have one option of a menu and I need to change the associated bitmap, in modifyMenu it asks me for a pointer to bitmap, but...
Should I take care to destroy that bitmap or the menu handles it ?
Thanks, Bye !
Braulio
|
|
|
|
|
Should I take care to destroy that bitmap or the menu handles it ?
You're responsible for destroying the bitmap. However, you should do it until the menu uses this bitmap. If you delete it earlier, you will see garbage in the menu item.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I need help bad!!!!!
I created a second toolbar in addition to the default toolbar. Everything works fine in release mode, but in debug mode, the application hangs upon exiting. If I remove the toolbar everything works okay. If I add just the definition of the toolbar and not the code, it hangs in debug mode. I'm using CToolbarEx to define the toolbar. Any ideal to what could be causing this?????
Any thought, comment or assistance would be greatly appreciated.
I found the following errors:
memory check error at 0x00D45834 = 0x00, should be 0xFD.
memory check error at 0x00D45835 = 0x00, should be 0xFD.
memory check error at 0x00D45836 = 0x00, should be 0xFD.
memory check error at 0x00D45837 = 0x00, should be 0xFD.
Could this be anything???
Thank-you
Sincerely,
RAH
|
|
|
|