WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: Jeremy Whilde on July 30, 2013, 11:19:50 AM

Title: How to Display MS Access Forms
Post by: Jeremy Whilde on July 30, 2013, 11:19:50 AM
I can connect to MS Access databases and run queries using WinBatch  but how do you say display a record as a result of a query?

So in VBA I believe you would use:

DoCmd.OpenForm "Employees", , ,"LastName = 'King'"

Is there a way to do this in WinBatch?

Could not find any direct examples:

Thanks JW
Title: Re: How to Display MS Access Forms
Post by: JTaylor on July 30, 2013, 11:33:45 AM
Take a look at Dynamic Dialogs.

Jim
Title: Re: How to Display MS Access Forms
Post by: Jeremy Whilde on July 30, 2013, 11:54:28 AM
I need to display the MS Access forms directly in Access not create something external.
I cannot change any of the forms, the database and the front end in Access is not ours and the customer
Just wants the existing forms displayed in Access from the result of a WinBatch query. Can this be done?

As I say the connection and query is not an issue but how to show the relevant form in Access is what we need to do.

Thanks JW
Title: Re: How to Display MS Access Forms
Post by: Deana on July 30, 2013, 12:15:05 PM
Check out the following code snippet in the tech database: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/OLE~with~Access+Control~Access~Forms.txt

See also: http://msdn.microsoft.com/en-us/library/office/ff195841.aspx
Title: Re: How to Display MS Access Forms
Post by: stanl on July 30, 2013, 12:24:28 PM
Quote from: Jeremy Whilde on July 30, 2013, 11:54:28 AM
I cannot change any of the forms, the database and the front end in Access is not ours and the customer
Just wants the existing forms displayed in Access from the result of a WinBatch query. Can this be done?


Depends. Is it a 'compiled' Access DB, i.e. you cannot open anything in design view?  Years ago, I wrote WB code for a company that had a proprietary access app. and wanted to change the logo on the reports. Simple a matter of creating a phantom access db, linking the tables and re-designing the report with the new logo which then accepted queries performed in WB. 

This may or may not apply to your situation.
Title: Re: How to Display MS Access Forms
Post by: Jeremy Whilde on July 30, 2013, 03:02:42 PM
OK seem to be getting somewhere now so I can sort of do whats required like this:

accObject = ObjectGet(, "Access.Application")
Cmd = accObject.DoCmd
Cmd.OpenForm("Contacts", , ,"FirstName = 'Randall'")

So this will as long as Access is running open a record from "Contacts" and only display a record where
the first name is 'Randall' this does a replace rather than moving to the record though. Have not worked
out how to move to/display a record in a list yet or how to and together qualifying fields on the contact form.

Thanks JW