Search results

  1. ErikSnoek

    Data Type of a field in a table

    Put the following code in a module and run showTableFieldTypes(). I only added 4 common data types in the daoDataTypeByNum function, but as you can see it's quite easy to expand :) Sub showTableFieldTypes() Dim tblTable As TableDef Dim tblField As Field For Each tblTable In...
  2. ErikSnoek

    Setting Default Value with code

    CurrentDb.TableDefs("name_of_your_table").Fields("name_of_the_field").DefaultValue = "Test"
  3. ErikSnoek

    Wait for External Application...

    Open a hidden form when the application opens. In this hidden form: - Set the Timer interval to 1000 - Set the On Open event to: Private Sub Form_Open(Cancel As Integer) booWordOpen = False End Sub - Set the On Timer event to: Private Sub Form_Timer() If FindWindow("OpusApp"...
  4. ErikSnoek

    allow edits - set to false but actually true - driving me mad!

    This could be caused by some VBA code changing some of the values on your form. Since it only happens on the very first record, do you have any code in the form open or load events that changes values?
  5. ErikSnoek

    Trying to extract info from an email.

    I wrote a new function that should work in your case. What you need to do is add "<data>" when the data starts and add "</data>" when the data end. Kinda XMLish :p. Here's what happens: 1. All text gets read from the file 2. The code searches for <data> and then </data> 3. All text between...
  6. ErikSnoek

    New Record Form Load

    You didn't specify on what event you'd like this new record to be created. If you do it on form load, as your post suggests, a new record would be created every single time the form gets opened..
  7. ErikSnoek

    Find a record and more...

    Function yourFunction() As Boolean Dim rstTable as DAO.recordset Set rstTable = CurrentDB.OpenRecordset("SELECT * FROM yourTable WHERE FieldA=1 AND FieldB=2") If rstTable.EOF Then yourFunction = False 'no records Else yourFunction = True Endif End Function
  8. ErikSnoek

    Freezing the fields on a form

    The code goes in VBA in the OnClick event of a button. You can use it on as many textboxes as you like. E.g.: Private Sub yourButton_Click() txtBox1.Locked = False txtBox2.Locked = False txtBox3.Locked = False End Sub
  9. ErikSnoek

    Check if another Access is running

    Or this code, which gives you a function like FindWindow except you can use wildcards in the caption which means you can just use the application title regardless of what form is opened. Option Explicit ' Module Name: ModFindWindowLike ' (c) 2005 Wayne Phillips...
  10. ErikSnoek

    Trying to extract info from an email.

    The code I posted skips all lines that do not have 4 fields that are delimited with a comma. This means that both the headers and the empty lines are skipped. Shouldn't it work in your particular situation, if you use option C? E.g.: SomeEmail.txt Sender: blabla <- Skipped...
  11. ErikSnoek

    Freezing the fields on a form

    You can set the "Locked" property in the Data tab of the textbox' properties to lock the fields. Then you can unlock them using a button by adding code like the following: txtYourTextBox.Locked = False or if you want to use one button to both lock and unlock: txtYourTextBox.Locked = Not...
  12. ErikSnoek

    Login Help

    Oh I'm sorry, please try the keydown event rather than the keypress event :) (Note: It's KeyCode there not KeyAscii, but it's the same thing)
  13. ErikSnoek

    Login Help

    The event passes on the ASCII code of the key that was pressed. You can use it to see if enter was pressed. The ascii code for Enter is 13, which you can also obtain by checking the ascii code of vbCr. Example: Private Sub txtYourTextBox_KeyPress(KeyAscii As Integer) If KeyAscii =...
  14. ErikSnoek

    Precision Error

    Alright, I think this should help: Set Param = Cmd.CreateParameter("Payment", adDecimal, adParamInput, Payment) Param.NumericScale = 3 'just guessing here Param.Precision = 2 Cmd.Parameters.Append Param
  15. ErikSnoek

    Trying to extract info from an email.

    This should work :). It skips the headers by checking if the line has 4 by comma delimited fields. Private Sub Import_Click() Dim objFilesystem As Object, objFile As Object Dim strLine() As String Dim rstTable As DAO.Recordset Set rstTable = CurrentDb.OpenRecordset("SELECT *...
  16. ErikSnoek

    Precision Error

    Perhaps using a Round on Payment could help? Set Param = Cmd.CreateParameter("Payment", adDecimal, adParamInput, Round(Payment,2))
  17. ErikSnoek

    How does the IsNull work??

    That is because the checkbox value is only null when no value has been specified. One of the many solutions to your current problem would be using: varPaid = IIf(IsNull(Me!Paid), False, Me!Paid)
  18. ErikSnoek

    Progess Bar (or equivalent)

    I created a simple example of this. It's included as attachment with this post :)
  19. ErikSnoek

    IF Then Else.......I need the Else answer

    WordRange.InsertBefore nz([Forms]![ProspectNotes]![ActdateComments], "") ?
  20. ErikSnoek

    IF Then Else.......I need the Else answer

    What do you mean with "What can I do when [ActdateComments] is null"? You can do anything you want! Do you mean you want to check if that value is null and if so, add a different value? The nz function does that for you. For example: WordRange.InsertBefore...
Back
Top Bottom