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...
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...
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...
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...
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"...
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...
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...
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
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...
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...
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...
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...
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.
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...
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)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.