Select All Forms In VBA
I want to run code to change the format of all open forms dynamically
Thank you for taking the time to report an issue.
What's wrong... Please write below.
on click event
I dont really have a clue about vba but im trying
1) Option Compare Database
2) Option Explicit
3) Public strLOC As String
4) Public strCode As String
5) Public strJCodeKey As String
Load them with this code:
1) Private Sub RadfordMatch_Click()
2) strCode = [Forms]![View RHI Job Pricing Master]![Job Code]
3) strLOC = [Forms]![View RHI Job Pricing Master]![LOC]
4) MsgBox "You will now be selecting matches for this position: " & strCode & " - " & strLOC, vbOKCancel
5) DoCmd.OpenForm "select Radford Jobs", acNormal, , , acFormEdit, acWindowNormal
6) End Sub
And then when a "select" flag is toggled on the following form the fields get copied to the form:
1) Sub Select_Flag_Click()
2) Dim strFlag
3) strFlag = [Forms]![select Radford Jobs]![Select]
4) If strFlag = -1 Then
5) [Forms]![select Radford Jobs]![RHI Job] = [Form_View RHI Job Pricing Master].strCode
6) [Forms]![select Radford Jobs]![LOC] = [Form_View RHI Job Pricing Master].strLOC
8) [Forms]![select Radford Jobs]![RHI Job] = ""
9) [Forms]![select Radford Jobs]![LOC] = ""
10) End If
11) End Sub
However, upon adding numbers to the form names (and trying to update the VBA respectively), the VBA no longer executes.
Run-time error '2450'
Microsoft Office Access can't find the form '13-frm_Transportation' referred to in a macro expression or Visual Basic code.
I've been running into this type of problem with of my forms -- VBA code which previously worked, but referred to other forms in some manner (include opening said forms), no longerwork when numbers are added into the form names!
I've got to ask: does Access not like people to put numbers in their forms? What is the correct syntax for referencing to forms in this manner?
I have trouble finding how to use SELECT statements within VBA in a simple context as mine surley is. The fact is, the table contains the names of every checkbox in a form, I want VBA to get those names from the table, see if they = TRUE, and then APPEND to a new table (which, thankfully docmd.runSQL works for). It just seems much cleaner than having to pour in sixty control names into the VBA code.
I've heard about using querydefs but they seem way outside the scope of my application, which is small
I am also looking for some clear and concise resources that I can look at for reference.
I have an initial start up page where someone in any division can go and select their division from a combo box. What I want them then to be able to do is click one of the forms (New Entry,Edit Entry,.).
For the form New entry I am looking to open the form with the division name to filled into a text box. I also would like to have that box that box also correspond to a field in a the table for a new entry.
So starting off with the business concept, making tables, queries, relationships, entry forms, overview forms, reports and the like, I always struggled where and when to use VBA. I seldom use any macro's.
But when I edit VBA (first keystroke) Access VBA plugin freezes and crashes.
Problem is on all databases using VBA
If I log on as a other user, problem isn't there.
I use Win7 64bit, Access 2010 32bit
I use .mdb format only
I've tried access.exe mydatabase.mdb /decompile
I would log on as other user, rename c:\users\myprofile and thus force it to create a new profile for me. But Windows 7 just creates a temporary profile as it can't find the old one.
I would prefer not to delete my profile through control panel, as I would like to be able to undo the change
EDIT: Actually, this might not be an VBA issue - I found out that I have no problems editing VBA code that has no forms (GUI), so the problem just might be regarding Forms and not VBA
I have tried the following:
Forms.frm01_Services.cmbServer.Value = Me!Server
Forms!frm01_Services.cmbserver_Click | -----Error
Line # 3 bombs - is there a function in access that allows me to do this?
1) Table1 containing fields: ID, Name, Wage, WorkingHours, Date,
2) Form1 containing: txtDate, txtCO
I must create a Function that Sum the Wage from last 5 days.
Exp1 = DSUM([Wage],[Table1],Where Date <[Forms]![Form1]![txtDate]-5)
But I must do it in SQL (VBA).
I can't undesternd how to VBA.
Function WA(CO) As Integer
Dim db As DAO.Database Dim rs As DAO.Recordset
Dim strSQL As String Set db = CurrentDb
If CO>0 Then
strSQL = "SELECT Sum(Wage) AS [SumOfWage] FROM [Table1] WHERE Date < Forms![Form1]![txtData]-5
Set rs = db.OpenRecordset(strSQL)
rs.Close db.Close Set db = Nothing
Deleting the VBA project removes code from modules, forms and reports. You should back up your database before attempting to open the database and delete theVBA project." message.
- I can't use the backup feature (I get the same error message)
- I can't compact and repair (I get the same error message)
- I can't move the forms into a new db (I get the same error message)
- I can't decompile (I get the same error message)
- when I save the forms as text - I get empty text files
- I can't open vba window (I get the same error message)