Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. GulfImages

    Code won't work with subform

    I've been testing it in the immediate window for now if that matters.
  2. GulfImages

    Code won't work with subform

    Hi Bill, It is a public sub in a module. I have another module that is specific to the form but not a class module to the form. It will do some validation then call this sub. I have my invoice items in a temporary table so I can verify things and such before sending them on to the table. I use...
  3. GulfImages

    Code won't work with subform

    Hello All, I have this bit of code that was derived from a lot of help here (Thanks AceMan1) and it works great on a main form but for some reason when I try to run it from a button on a main form, for data in a subform I get a Compile Error: Expected Function or Variable. When I compile the...
  4. GulfImages

    Jaws friendly textbox

    I would also consider labelling it something like "Jaws User" or something other than VI as there could be liability issues if someone feels singled out. I like laws that help the disabled, particularly blind people because of my daughter, but if you are in the US, you have to be careful...
  5. GulfImages

    Jaws friendly textbox

    What about making a flag for the user that is VI and using a sub procedure to set the tab properties of the labels on opening the form? I'm not a programmer but I appreciate what you are doing as my Daughter is VI so I thought I'd give it a shot. Even if you don't have users you could put a...
  6. GulfImages

    Using a Sub Name as a variable

    Thanks Joe, it's not a public vs private thing. Using your example, I want to do something like this: Sub cmdCall_Click(othersub) CallByName Me, "othersub", VbMethod End Sub The 2 subs below would be my choices based on the form I'm using at the time: Sub HelloWorld() MsgBox "Howdy"...
  7. GulfImages

    Using a Sub Name as a variable

    I'm not sure if I need that, it's just another sub in the same database. I just can't seem to explain this properly. Say it was just MainSub() and inside I have criteria that tells CheckCustomer() to run, I would simply enter: CheckCustomer or Call CheckCustomer() at the right place isnide...
  8. GulfImages

    Using a Sub Name as a variable

    PHV, I thought it should be Call instead of Execute as I had never seen Execute used for this. (In my limited scope). Joe, I do understand about making subs public, thanks. I guess I'm not explaining well. I'm making a sub that can be used on many forms, when I do use this sub another sub...
  9. GulfImages

    Using a Sub Name as a variable

    Yes, there is some criteria before it runs. So It would be something like this?: SubNewRecord(NameofOthersub, othervariable, other_variable) Some criteria... Execute NameofOthersub(somevariabledata) End Sub
  10. GulfImages

    Using a Sub Name as a variable

    passed form should read passed from
  11. GulfImages

    Using a Sub Name as a variable

    I'm confused? Taking pages of different code that I've made for each form and condensing it into code that can be used on all forms is adding a layer of obfuscation? I need to run a sub within a sub based on certain criteria and when it happens, I need the name of the sub to be passed form the...
  12. GulfImages

    Using a Sub Name as a variable

    Hi All, I'm trying to trim down my code and am creating master funtions to aleviate redunancy. I have a Sub that I want to have a variable that names another sub I want to run: Sub NewRecord(NameofOtherSub, etc, etc) If something happens then NameofOtherSub End If I don't know if it...
  13. GulfImages

    Making this work with any form

    All I needed was to use Call: Call AddNewRecord("tblCustomers", Forms!frmCustomers) I also found my already declared and set form variable can be used: Call AddNewRecord("tblCustomers", CF) This great! I really appreciate it. I've looked around here to try and contribute and if I can I...
  14. GulfImages

    Making this work with any form

    Actually, when I try to type in using Me, AddNewRecord("tblCustomers", Me) I get the expected = error when I press enter as well so I can't test it.
  15. GulfImages

    Making this work with any form

    Okay, the reason I was worried about using Me was there may be 2 different forms open at a given time that both use this sub to update records (couldn't ever be at the exact same time), could there be a conflict? If I wanted to explictly declare the form by name wouldn't it be...
  16. GulfImages

    Making this work with any form

    I actually already have a variable declared for the form within the code already running it's named CF I don't know if I could use that variable inside my AddNewRecord("tblCustomers", "CF") sub or something like that.
  17. GulfImages

    Making this work with any form

    I'm almost there: Here is what I ended up with: Sub AddNewRecord(mytable, myform As Form) Dim db As DAO.Database, rst As DAO.Recordset, ctl As Control Set db = CurrentDb Set rst = db.OpenRecordset(mytable, DB_OPEN_TABLE) rst.AddNew For Each ctl In myform.Controls...
  18. GulfImages

    Making this work with any form

    Thanks AceMan1, I know I'm still using old techniques.
  19. GulfImages

    Making this work with any form

    That was fast!, I tried to follow up quickly, but I think you answered my question, thanks. I would need to use the quotes when using the sub?: AddNew("tblSuppliers", etc, etc)
  20. GulfImages

    Making this work with any form

    mytable would actually be declared in the sub so I could change it for each form ie... Sub AddNew(mytable, etc, etc)

Part and Inventory Search

Back
Top