Search results

  1. D

    Efficiently storing data

    tblCategoryGroups GroupID [autonumber, PK] strGroupName tblCategories CategoryID [autonumber, PK] GroupID [foreign key to tblCategoryGroups] strCategoryName tblContacts contactID contractName tblContactLinks linkID [autonumer, PK] ContactID CategoryID Something like that maybe? Not...
  2. D

    Retrieving Module Line Number

    This thread is a bit old, but i was looking to do this as well. Here's what I found at vb123.com Sub TestErL() 'This function shows how a line number can be printed out with an error 50 On Error GoTo Err_Wally 100 DoCmd.OpenForm "MyForm" 200 Exit Sub Err_Wally: MsgBox "Error line...
  3. D

    Pop-Up Box

    If u create a new form bound to your 'SBS' table, with a text box on it bound to your 'Special' field, and say call the new form 'frmSpecial' Then from your 'Special' button on your main form, do something like this: sub special_click() Dim strCrit as string strCrit = "[sbsID] = " &...
  4. D

    can you use variables in different subs??

    U can also declare the variable at the top of your form code, but only if u want to use the variable on that form only. Otherwise u have to declare it as a global variable. Dim DebitTot As String Private Sub SaveClick DebitTot = DMax(Blah Blah Blah) End Sub Private Sub AddNewClick...
  5. D

    Disable Warnings Problem

    Also, you might want to move the docmd.setwarnings true, ... DoCmd.OpenQuery stDocName12, acNormal, acEdit Exit_Command6_Click: DoCmd.SetWarnings true Exit Sub Err_Command6_Click: MsgBox Err.Description Resume Exit_Command6_Click End Sub That way warnings...
  6. D

    can someone please help me

    How about adding some forms for data entry. For example, forms for adding/editing employees, members, items etc.
  7. D

    Still Struggling with NotInList

    You have to add a reference to "Microsoft DAO object Library" in order to use "Dim db as database" Then make a few changes, mainly your SQL statment, Private Function AddToList(strTable As String, strField As String, _ strData As String) As Integer ' Add item to table ' Returns acDataErrAdded...
  8. D

    Start Up Menu

    rpadams, When you open a report, show your custom toolbar, docmd.showtoolbar "myPrintToolbar", acToolbarYes and then hide it on the reports close event, docmd.showtoolbar "myPrintToolbar, acToolbarNo That should work. Dave
  9. D

    Start Up Menu

    You can also use, DoCmd.ShowToolbar "menu bar", acToolbarYes ' To show it and DoCmd.ShowToolbar "menu bar", acToolbarNo ' To hide it Dave
  10. D

    Looping Through Listbox

    Elana, Something like this should work: Private Sub cmdTest_Click() For i = 0 To lstTest.ListCount - 1 If lstTest.Column(4, i) = "CA" Then ' Do some stuff End If Next i End Sub Remember columns and rows in a listbox start at 0. Dave
  11. D

    pop up forms

    If the combobox was bound to the wrong column wouldn't it just not show any Data? For it to be asking for a parameter it has to be a problem with the naming. But then again I could be wrong.:p Try this anyway: Go into the query (design mode). Select the criteria you have in there now and...
  12. D

    Print Form

    Hey Chris, There's no onPrint event for forms that I know of, but you can use docmd.printout to do the same job. Just put a command button on your form and add the rest of your code after the docmd.printout. Dave
  13. D

    If IsNull Then fo multiple controls

    Private Sub cmdtest_Click() Dim intErr As Integer intErr = 0 intErr = testCtls(txtSample1) intErr = testCtls(txtSample2) intErr = testCtls(txtSample3) intErr = testCtls(txtSample4) If intErr = 0 Then 'perform some stuff End If End Sub Public Function...
  14. D

    Getting The Name Of a Pressed Command Button

    Striker, I have no idea how you would do that! But, here is a method that will require less code then what you are using. Private Sub cmdButton1_Click() Dim ctl As Control Set ctl = cmdButton1 formatButton ctl End Sub Public Sub formatButton (myCtl As Control) With myCtl...
  15. D

    reports in a dropdown?

    And if you don't want to use the Hidden System tables, use the AllReports collection as Pat also suggested. Private Sub Form_Open(Cancel As Integer) Dim obj As AccessObject, dbs As Object Dim strReports As String Set dbs = Application.CurrentProject For Each obj In...
  16. D

    Automatic pop up form/message

    Sam, If you want to check the expirey dates when the database is opened, create a macro called "autoexec", which runs code like that which llkhoutx provided. Dave
  17. D

    Refresh combo box and form select list.

    Peter, The code you are using opens the form and then continues to execute the rest of the code in that procedure, therefore your requeries and other code is being executed too early and will not execute again. If you change: DoCmd.OpenForm "pupDeleteContactCheck" to DoCmd.OpenForm...
  18. D

    SQL of a query

    Marco, If you want to run the query in code enter this into the onclick event procedure: DIM strSQL as string strSQL = "INSERT INTO Total_List ( [Company#], Company_Name) " & _ "SELECT Selected.SlctCompany, Selected.Slct_Company2 " & _ "FROM Selected" docmd.runSQL strSQL If you want to add...
  19. D

    Building Queries in Code

    How about this? Public function repText(strText As String) Dim strNewText As String ' Replaces all occurences of a single quote with two single quotes strNewText = Replace(strText, "'", "''", 1, -1, vbTextCompare) repText = strNewText End Sub Dave
  20. D

    ADO Recordset

    Hey Jon, this is straight from a book so I will assume that it works. :p Sub Editrecords() ' Procedure that edits data Dim rst As ADODB.Recordset Dim strSQL As String On Error GoTo errHandler 'Create the recordset object Set rst = New ADODB.Recordset 'Write the SQL Statement to return the...
Back
Top Bottom