Search results

  1. F

    Class Design Help: Related Data

    Hi All, So here's a general scenario: I create a VB Class which allows the user to create a client record for a table. Let's assume one of the fields in the Client table is a field called SalespersonID which relates to another table with Salesperson Name and their respective ID (key). What's...
  2. F

    Data Validation 'Tag Method'

    Glad to hear it! Please click Thank button if it was helpful :)
  3. F

    Data Validation 'Tag Method'

    It worked fine for me using Access 2010. Maybe its the nz() function? Try removing them but I'm not sure why you'd get that error. I'm sure you get the gist of it though, using the BeforeUpdate event.
  4. F

    Data Validation 'Tag Method'

    If you're willing to consider a change to your approach you can do the following to get the same exact result. It's also a little more cleaner. Instead of a function, just validate the code by using the BeforeUpdate event: 'Cancels Update if required fields are missing. 'if fields are...
  5. F

    Data Validation 'Tag Method'

    Ok, we need to drill down further. Can you change: If validateform(Me.Form) Then DoCmd.Close acForm, Me.Name to this: If validateform(Me.Form) Then DoCmd.Close acForm, Me.Name End If Compile again and tell me which line it highlights when the error is displayed.
  6. F

    Data Validation 'Tag Method'

    Strange. Are you getting the same error message or something different?
  7. F

    Startup table

    Did you check File -> Options -> Current Database -> Display Form?
  8. F

    Data Validation 'Tag Method'

    Ah, I think I see what the problem is. Try this: If validateform(Me.Form) Then DoCmd.Close acForm, Me.Name Make sure you do the same with the other DoCmd.Close statement in your function. Explanation: You need to pass two arguments when calling the DoCmd.Close method. Firstis the type of...
  9. F

    Compile error: user defined type not defined.

    Glad to hear. The yellow highlight is the line where the code execution broke. In this case, VB tried to initialize the subroutine "btnPost_Click" but it failed (stopped) because you the line of code you commented out was trying to declare a Type that didn't exist.
  10. F

    Compile error: user defined type not defined.

    Is "Dim strMsgBox As StringForm.Recalc " supposed to be "Dim strMsgBox As String" ? VB seems to think 'StringForm.Recalc is a undefined user-defined type.
  11. F

    Data Validation 'Tag Method'

    Sorry, go back to Private Sub Save_Record_Click() and change: If validateform Then DoCmd.Close to: If validateform(Me.Form) Then DoCmd.Close
  12. F

    Data Validation 'Tag Method'

    You don't need to move it, I was just asking because the answer differs depdending on where the procedure is. Try changing this: Public Function validateform(ByRef frm as Form) As Boolean 'returns true if all required fields have data, or false if not. 'It will also create a popup message...
  13. F

    Dynamic hyperlink word document to a filepath directory textbox in access

    If I understand your post, you're trying to associate a hyperlink address to a textbox control. You may want to look into the Textbox.Tag property. The Tag Property allows you to store a value that can be later retrieved. For Example, in your Form's Load() procedure, you can do something...
  14. F

    Data Validation 'Tag Method'

    tdefreest, Is the the procedure "validateform" in the Form's module itself or is it in it's own code module? If the procedure is in the form's module, the you don't need to pass a reference to the form, you can do this instead: Your Function: Public Function validateform() As Boolean...
  15. F

    How to build a custom MsgBoxs in (Audit Trail)

    Replace the MsgBox line in your code with this line: DoCmd.OpenForm FormName:="FORM_NAME_HERE", WindowMode:=acDialog Opening a form as a Dialog pauses code execution, just like a message box does. Be sure to replace "FORM_NAME_HERE" with the name of your custom message box form. In your...
  16. F

    Data Validation 'Tag Method'

    For your first issue, try validateform(Me.Form) instead of validateform(Me) For your second issue, Just add the code you want to execute before you close the form: If Me.PrimaryID & "" <> "" Then If validateform(Me.Form) Then 'email code here 'excel code here...
  17. F

    Using a Collection Object in a Custom Class

    Thank you all for your contribution to the thread! I ended up creating a custom class which is a "wrapper class" of the Collection object. I wrapped all but the Add method so it's essentially read-only externally and internally, I can simply refer to the private collection variable to invoke the...
  18. F

    Using a Collection Object in a Custom Class

    Hello! I'm writing a custom class in Access and I have a Collection object declared as as Public, Read/Write property. The Collection will hold objects related to the main class object. I want to be able to add objects to the Collection from within the class, but I don't want to user to...
  19. F

    List Query name and expression

    I went back and took a look at this, and it seems you can't get the actual expression of a Query field using .Expression (or .Properties("Expression"). That only seems to work for Tables, not Queries. The only way I was able to actually see the expression of a field in a Query was by returning...
  20. F

    List Query name and expression

    Yes, I'm sorry. Replace that with the name of the calculated field. There's a better way to all this, but I'm short on time. Will post tomorrow.
Back
Top Bottom