Access Switchboard Command To Run Query

Oct 31, 2004

Hi!
I'm working on an Access file. I know how to create a swtitchboad and have it appear when the file opens. The switchboad will have three commands. The commands will be:

1. Open a form called "FORM1" in add mode.

2. Run a query named "Query1" so that it will run a query that is the only query in the file. The query only lists ten items of information entered in the ONE most recently completed entry in ONE table.

3. Close the switchboard and then close the file.

I know how to do the first and third commands. Does anybody out there know how to write the code, or the macro, or whatever it's called that will do the second one?
Thanks,

pfdjr

View Replies


ADVERTISEMENT

Backup Database By Use Of Command Button On Switchboard

Sep 3, 2004

Is it possible to create a command button on an Access switchboard that will automatically backup a database? What code would I need? The command button wizard doesn't handle this task.

View 14 Replies View Related

General :: Use Hyperlink Command In Switchboard Database

Apr 17, 2015

I have a number of databases in my system and I created a database that only has a switchboard form in it. This switchboard form has links to all of the various databases I have created and opens their default input form. This works fine but now I wish to place a button on the switchboard to run a report that is located in one of the databases.

I tried to use the hyperlink command in the switchboard database but that will not show me the information in the other databases only the switchboard database. I assume I have to link the databases and create a connection to the other database and its report.

View 8 Replies View Related

Can I Access A Query From A Switchboard?

Apr 14, 2007

I am trying to access a query from a switchboard. I see that the Switchboard Manager shows you only reports and forms - no queries. How can I run a query from a switchboard?

Robert

View 4 Replies View Related

Switchboard Access

Apr 12, 2007

I'm sure there probably an easy explaination for this, how do you make the main switchboard a desktop icon instead of going into the database so that all they have access to is the switchboardand the forms etc.

View 3 Replies View Related

Access 07 Switchboard HELP!!

Feb 27, 2008

Pretty much ive became stuck in access 07. i have made all my forms and i have made my switchboard but when i when i looked for the "startup" option as existed in 2000 i couldnt find it.

Basically i am setting up a database as part of my alevel coursework and unfortuanatly i am the first person to reach the stage of wanting to run the switchboard on startup. I would greatly appreciate it if any one could shed any light on how to run a switchboard automatically on startup. i know it is probably something reli simlple that i have just over looked so any help at all would be just great :D

cheers, Paul

View 2 Replies View Related

Switchboard Not Available In Access Database

Aug 29, 2005

As a newcomer to Access programming I have just shot myself in the foot!
I unticked all the start-up boxes and the switchboard no longer appears. My database works fine (thanks to several articles in your amazing forums) but I don't know how to access the switchboard as I need to add a delete record button to a form.

Silly but true, I seem to remember that the switchboard can be unhidden by pressing a few keys?

I would be grateful if someone could spare a few seconds to advise.

Ralphie :o

View 3 Replies View Related

Access Switchboard Problems!

Feb 18, 2007

Im creating a acccess database system as part of my A-level ICT project. Im having problems with the switchboard, which i designed using the Switchboard Manager. it comes up with the following error message:

Run-time error ‘2465’:

Pass-It Driving School can’t find the field ‘Option8’ referred to in you espression.

Then when clicked on 'Debug' it displays the VB code as follows:

Private Sub FillOptions()
' Fill in the options for this switchboard page.

' The number of buttons on the form.
Const conNumButtons = 8

Dim con As Object
Dim rs As Object
Dim stSql As String
Dim intOption As Integer

' Set the focus to the first button on the form,
' and then hide all of the buttons on the form
' but the first. You can't hide the field with the focus.
Me![Option1].SetFocus
For intOption = 2 To conNumButtons
Me("Option" & intOption).Visible = False
Me("OptionLabel" & intOption).Visible = False
Next intOption

' Open the table of Switchboard Items, and find
' the first item for this Switchboard Page.
Set con = Application.CurrentProject.Connection
stSql = "SELECT * FROM [Switchboard Items]"
stSql = stSql & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
stSql = stSql & " ORDER BY [ItemNumber];"
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSql, con, 1 ' 1 = adOpenKeyset

' If there are no options for this Switchboard Page,
' display a message. Otherwise, fill the page with the items.
If (rs.EOF) Then
Me![OptionLabel1].Caption = "There are no items for this switchboard page"
Else
While (Not (rs.EOF))
Me("Option" & rs![ItemNumber]).Visible = True
Me("OptionLabel" & rs![ItemNumber]).Visible = True
Me("OptionLabel" & rs![ItemNumber]).Caption = rs![ItemText]
rs.MoveNext
Wend
End If

' Close the recordset and the database.
rs.Close
Set rs = Nothing
Set con = Nothing

End Sub

Private Function HandleButtonClick(intBtn As Integer)
' This function is called when a button is clicked.
' intBtn indicates which button was clicked.

' Constants for the commands that can be executed.
Const conCmdGotoSwitchboard = 1
Const conCmdOpenFormAdd = 2
Const conCmdOpenFormBrowse = 3
Const conCmdOpenReport = 4
Const conCmdCustomizeSwitchboard = 5
Const conCmdExitApplication = 6
Const conCmdRunMacro = 7
Const conCmdRunCode = 8
Const conCmdOpenPage = 9

' An error that is special cased.
Const conErrDoCmdCancelled = 2501

Dim con As Object
Dim rs As Object
Dim stSql As String

On Error GoTo HandleButtonClick_Err

' Find the item in the Switchboard Items table
' that corresponds to the button that was clicked.
Set con = Application.CurrentProject.Connection
Set rs = CreateObject("ADODB.Recordset")
stSql = "SELECT * FROM [Switchboard Items] "
stSql = stSql & "WHERE [SwitchboardID]=" & Me![SwitchboardID] & " AND [ItemNumber]=" & intBtn
rs.Open stSql, con, 1 ' 1 = adOpenKeyset

' If no item matches, report the error and exit the function.
If (rs.EOF) Then
MsgBox "There was an error reading the Switchboard Items table."
rs.Close
Set rs = Nothing
Set con = Nothing
Exit Function
End If

Select Case rs![Command]

' Go to another switchboard.
Case conCmdGotoSwitchboard
Me.Filter = "[ItemNumber] = 0 AND [SwitchboardID]=" & rs![Argument]

' Open a form in Add mode.
Case conCmdOpenFormAdd
DoCmd.OpenForm rs![Argument], , , , acAdd

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument]

' Open a report.
Case conCmdOpenReport
DoCmd.OpenReport rs![Argument], acPreview

' Customize the Switchboard.
Case conCmdCustomizeSwitchboard
' Handle the case where the Switchboard Manager
' is not installed (e.g. Minimal Install).
On Error Resume Next
Application.Run "ACWZMAIN.sbm_Entry"
If (Err <> 0) Then MsgBox "Command not available."
On Error GoTo 0
' Update the form.
Me.Filter = "[ItemNumber] = 0 AND [Argument] = 'Default' "
Me.Caption = Nz(Me![ItemText], "")
FillOptions

' Exit the application.
Case conCmdExitApplication
CloseCurrentDatabase

' Run a macro.
Case conCmdRunMacro
DoCmd.RunMacro rs![Argument]

' Run code.
Case conCmdRunCode
Application.Run rs![Argument]

' Open a Data Access Page
Case conCmdOpenPage
DoCmd.OpenDataAccessPage rs![Argument]

' Any other command is unrecognized.
Case Else
MsgBox "Unknown option."

End Select

' Close the recordset and the database.
rs.Close

HandleButtonClick_Exit:
On Error Resume Next
Set rs = Nothing
Set con = Nothing
Exit Function

HandleButtonClick_Err:
' If the action was cancelled by the user for
' some reason, don't display an error message.
' Instead, resume on the next line.
If (Err = conErrDoCmdCancelled) Then
Resume Next
Else
MsgBox "There was an error executing the command.", vbCritical
Resume HandleButtonClick_Exit
End If

End Function

[SIZE=3]Could someone kindly help me with this problem as im not a very experienced user with VB. Any Help would be appreciated. u can email me on [B]atiqskool at yahoo.co.uk

View 1 Replies View Related

How Can I Show Switchboard Only (i.e Access Doesn't Appear To Be Open)

Jul 19, 2005

Hi,
Does anyone know if I can just show the switchboard only so that it looks like a program, or if I can use an existing MDB to create an .exe??

View 2 Replies View Related

Linking From Switchboard To Switchboard On Two Or More Databases

Nov 21, 2006

I am working on a database that will be an addition to an existing one on the company server. However, to make the overall layout not so complex and allow room for other additions in the future, I'd like to keep the databases separate. This will also ensure more efficiency, integrity and troubleshooting overall.

I have the original database with the name of "Cell MFG Screen" that contains a switchboard. I am now creating a db to keep track of manufacturing waste (which will also be on the same server when completed). That switchboard is called "Cell Waste Weight". Again, I want to keep these db's separated from one another as well being able to add future dbs. Now, what my plan is to make up a one db that consists of only a switchboard that will be used as the main switchboard to be able to navigate to other dbs that are located on the server.

Does anyone know how this is done?

Thank you in advance for your help,

~Kilch

View 10 Replies View Related

User Security Access 2013 For Switchboard Items

Aug 3, 2015

I have user security level setup with username and password.I have set forms and tables etc to security levels.what i am having trouble with is setting user security levels to command buttons on the switchboard.Example if you sign in Mary Jones and you click on the command button (open Tom Smith switchboard) button on the main switchboard and your not tom smith you get a message access denied.

Code:
Private Sub Form_Open(Cancel As Integer)
If Forms!frmLogin!cboUser.Column(4) <> 2 Then
MsgBox "you cant open this form"

[code]...

it is a switchboard page. and putting CoCmd.OpenSwitchboardPage that does not work either..when you look at the event on click of the command button a macro opens up but I dont see how you can edit it.

View 5 Replies View Related

Switchboard Query

May 3, 2005

Hi guys,

I've got a form that shows the result of a query in datasheet mode.

However if I use a switchboard to open the form (and hence run the query) the results aren't in datasheet mode but in column mode.

How do I get the this query to display in datsheet view?

Thanks

View 2 Replies View Related

Add A Query To A Switchboard

Nov 8, 2007

hi i have a query that is connected with a form. Now i want to add that form to the switchboard, but i have to add the qry as the form doesnt work without the qry. so i was wondering if anyone knew how to add a qry to a switchboard??

View 2 Replies View Related

Running A Query From A Switchboard

Jan 21, 2008

I have an SQL query which simply deletes any blank records from a table. I want to put it on a switchboard menu, but cannot see an option to do that. How do I do this? Perhaps create a little form and put a button on it to run the query?

Robert

View 1 Replies View Related

Switchboard Front Page - Users Able To Access Forms For Data Input

Dec 8, 2011

I have created a switchboard 'front page' through which I hope for users to access the forms for inputting data.

Within this front page I have an 'enter' button - successfully created - everything.

However, I am unclear as to how you activate this, or any other button. I have linked it to the appropriate form and stated the action I want it to undertake, but nothing is happening.

What further instructions do I need to provide ...and where?!

View 5 Replies View Related

Re-opening 'switchboard' After Closing Crosstab Query?

Jan 12, 2006

I have a 'switchboard' form called Menu (not created by access wizard). One of the buttons down the navigation tree opens a crosstab query for the user to examine a data summary; but the 'Menu' form is still visible right in front of the query. Now, I could close the Menu form easily enough when the run query code is triggered, but that would leave the user loose in the database window when they eventually close the crosstab query window.

All that I have read on database navigation says that this is bad thing.

I can't place the crosstab query into a form or report because the column headings/fields don't appear when I try. (The field headings of the cross tab query are likely to change based on the underlying select query parameters so I can't hard-code the field names).

So, any thoughts on how to reactivate my Menu once the user closes the crosstab query or else puts the focus on the database window? (I achieve this using vba code in the on_close events of other forms and reports but I don't see an equivalent option for queries!)

Please note that I'm a vba newbie!

Thanks,
Craig

View 5 Replies View Related

Count On Query And Displaying Result On A Switchboard

Jul 31, 2006

Hi Folks

More questions from the newbie :eek:

I have a very simple table with a field that will have only the values open or closed

I created a query based on this table and used the count function (to count open or closed cases) and in the next querie field I used the group by open.

This gives me a count of all open cases

I can do the same for closed cases.

I want this count to be displayed on a Switchboard form but i cant get my nehad round how to get it there.

Can anyone help me out ?

Many thanks

Jimmy

View 6 Replies View Related

LEN Command In Access / Sql

Nov 1, 2006

I have the following sql statement:


SELECT [PhoenixInventory-FTP-1].[Mfg Name] AS Mfg, [PhoenixInventory-FTP-1].VendorID, [PhoenixInventory-FTP-1].[Part #] AS [Part#], [PhoenixInventory-FTP-1].ID AS PartID, [PhoenixInventory-FTP-1].OH AS OnHand, [PhoenixInventory-FTP-1].OO AS FacOnOrder, [PhoenixInventory-FTP-1].[90DayUsage], [PhoenixInventory-FTP-CustOO].CustOO, [PhoenixInventory-FTP-CustOO-90].CustOO AS CustOOWithin90Days
FROM ([PhoenixInventory-FTP-1] LEFT JOIN [PhoenixInventory-FTP-CustOO] ON [PhoenixInventory-FTP-1].ID = [PhoenixInventory-FTP-CustOO].ID) LEFT JOIN [PhoenixInventory-FTP-CustOO-90] ON [PhoenixInventory-FTP-1].ID = [PhoenixInventory-FTP-CustOO-90].ID;


I wish to take this query and only display the Part #'s with less than 8 characters. I am pretty sure I need to use the LEN function, but am not sure on how to do it. Any ideas?

View 1 Replies View Related

Using Last Rec Command In Access

Aug 31, 2007

Hey everyone,

I recently converted Access tables to SQL and had to change the forms to pull the info from the tables using filters instead of querys.

My problem is a form that has 3 subforms that use filters that are assigned by tank number. Subform 1= tank 111, subform 2= tank 222 and so on.

Since then, I can not get the subforms to load (on open) at the last record. It will only come in at the first record.

I have tried to use the DoCmd.GoToRecord , , acLast
on each subform and on the main form itself. It does not work.

Currently on the subform I have....

DoCmd.GoToRecord , , acLast
Form_Main_111_subform.OrderBy = "date"
Form_Main_111_subform.OrderByOn = True
Form_Main_111_subform.Filter = "Tank = 111"
Form_Main_111_subform.FilterOn = True

It works if you only pull up the subform but not when you use the main form....

And no, it does not work if you move the DoCmd line to the end after filtering. Access croaks when I try it.

View 14 Replies View Related

MS Access Command Button

Apr 16, 2008

Hi All,
I have what it most likely a fairly simple question that I'm looking for help on.

I have a MS Access table called "Products". The table has (4) fields called "SerialNumber" "ModelNumber" "ModelName" and "WarrantyDate"

I have created a form called "Warranty Status", the form contains a text box and a command button.
I would like to set it up so a user would type the serial number into the text box and click the button. If the warranty date associated with the serial number shows to be in warranty, I'd like to display the message to say, "you're item is in warranty". If beyond the warranty date, "Sorry, You Are Out Of Warranty"

Any help on the VB code is greatly appreciated!

View 7 Replies View Related

SQL Command Convert Into Access

Dec 15, 2011

select Saler, Model, Price, DDate
from DB_Table where DDate in

(select max(DDate) from DB_Table where Valid = 'ok' group by Saler, Model)

How can I make it work in ms access 2007? I am trying to get valid (ok) price for Saler-Model group at max date.

View 4 Replies View Related

Transfer Spreadsheet Command Access 97

Jul 19, 2005

This problem seems crazy to me.......

If I create a macro with a single entry consisting of Transferspreadsheet from a single Access table to Excel it exports perfectly. When I call Transferspreadsheet from VBA code it moves some of the data and puts them into seemingly random Excel spreadsheet columns why is this?

This issue first came about when we had to export a table with more than 65,000 records in and so I export using a table name "Sheet1" , "Sheet2" as needed but surely the table name that it comes from makes no odds?

Any help appreciated!

Regards,

Neil

View 2 Replies View Related

Exporting To Access Using Command Button

Sep 7, 2004

Dear All:

I have a form with multiple fields. I have created a command button which launches excel when pressed.

I wish to export specific fields from access to excel when this command button is pressed. In addition, specific fields from access is to be exported to specific fields in excel.

When I press this command button, it opens excel, and thats all.

Here is the code so far:

Private Sub excel_Click()
On Error GoTo Err_excel_Click
Dim oApp As Object
Set oApp = CreateObject("Excel.Application")
oApp.Visible = True

'Only XL 97 supports UserControl Property
On Error Resume Next
oApp.UserControl = True
Exit_excel_Click:
Exit Sub
Err_excel_Click:
MsgBox Err.Description
Resume Exit_excel_Click

End Sub

I am not the best programmar, any help will be wonderful.

Many thanks in advance,

Dion

View 3 Replies View Related

Forms :: Copying Command Button Appearance Properties To Other Command Buttons

Dec 17, 2013

I am rewriting an old Access 2003 database in Access 2010. When creating new command buttons, the current theme gives them a default appearance. I need to apply this appearance to old command buttons. I know there is a way to select the default button and apply its properties to others quickly. I have done it before but didn't write the process down .

View 2 Replies View Related

How To Run A Command Prompt Script Automatically From MS Access

Aug 13, 2007

I want to run a Command Prompt instruction. Is it possible to do it pass it from MS Access, not from the Command Prompt Window?

Thanks,

View 1 Replies View Related

Command Line To Display Access Report

Sep 19, 2004

I am looking for help to to generate a command line to automatically run a report within a windows program I am using. The program I use has command line fields to automatically open the access report when I complete my program session. I have tested the command line with a standard C:.... .exe to open Word, Access, etc.

I have tried using the create shortcut and snapshot methods without success and wondering if a macro is needed (havent a clue).

Hoping someone can help!

thanks... Keith

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved