Referring To Form By Using Its Index Number

Aug 23, 2006

How can I refer to a form by using its index number? Also how can I retrieve an index number of a form?

(I'm opening multiple instances of the same form and read that the only way to refer to those instances is by using their index number. I found some solutions that use hWnd as well but I can't get any further support on it as far as referring to a form by using the window handle so I'm trying to capture and then use the index number)

View Replies


ADVERTISEMENT

Delete Fields Referring To Field Number

Aug 5, 2006

I need to trim a lot of tables. Is it possible to delete table fields with reference to the field number instead of field name?

The command 'tblMyTable.Fields.Delete ("FieldName")' takes a string (field name) as input. I rather like to - in a loop - delete say,

Sub DeleteFields()
For i = 40 To 60
tblMyTable.Fields.Delete Field(i) ' Not correct syntax
Next i
End Sub

thh

View 2 Replies View Related

Modules & VBA :: Right Click Menu Command Bar Index Number?

Aug 13, 2014

I have a form that i used the following code on to stop people accessing anything naughty:

Code:
Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i

This works great and gets rid of all the menu bars.

The problem is that it also stops the user getting the right click menu up in a datasheet view.

I assume i just need to enable the correct menu bar index number but i don't know what it is so my code would be:

Code:
CommandBars(X).Enabled = True

So do I need to bring back more than one command bar to get it working?

View 4 Replies View Related

Forms :: Referring A Form Inside A Form Using Access 2007

Mar 10, 2013

I have a Form called X which contains a subform called Y. I have placed this Form inside another form called Z.

There is a CommandButton which when clicked must refer to the Subform. How do I do this?

I tried using [Z]![X]!Y, Form_Z.Form_X.Y, [Z]![X].Y but it throws an error saying the form name has been misspelled ...

View 4 Replies View Related

Modules & VBA :: Referring To Tab Control On Sub Form

Jun 9, 2013

I have the following setup:

A main form - named [formMain]
On [formMain] I have a tab control - named [tabMain]
[tabMain] has 3 pages named [pageOne], [pageTwo] and [pageThree].
On [pageThree] I have created a subform named [formSub].
On [formSub] there is a tab control named [tabSub].

Now what I would like is to make [tabSub] (in)visible if the user switches from [pageOne] or [pageTwo] to [pageThree].

Code:
Sub tabMain_Change()

How do I refer to [tabSub] from within this subroutine? I am trying something like:

Code:

Forms![formMain]![pageThree].Form![tabSub].Visible = False

but it is not working. What should be the correct way?

View 2 Replies View Related

General :: Referring To A Field That Is Not In A Form

Dec 3, 2012

I would like to know if it is possible to refer to a field even tho it is not in a form, i.e.,

PHP Code:

strSql = "UPDATE tblItems " & _ "SET StockQTY = ([StockQTY]+1) " & _ "WHERE ItemsID = " & [ItemsID] & "" 

The [ItemsID] is actually on the form as a txt box. but i dont really need it there for any other purpose other than the vba above.

In the form i have a field that is in the form as a txt box that has a relationship to the ItemsID. i have attached a image of the relationship.

The field that is in the form is tblOrdersItems.OrdersItemsID and i also have tblItems.Items. so rather than adding another meaningless txt box to the form(ItemsID) i would like to be able to use the relationships to get the correct ItemID ...

View 1 Replies View Related

Forms :: Referring To Form And Subform Combo Box

Jul 21, 2014

I have a form named frmMain that contains five buttons that lead to subforms, one of which is named frmDeceased.

In frmDeceased, I needed to create a combo box that relied on selections from the combo box before it. I was able to do this successfully in frmDeceased, but then today when I opened the database and opened frmMain, I realized that the query fails when frmDeceased is opened via frmMain. It works perfectly if I just open frmDeceased directly.

The first combo box is ROHE and the second is Iwi (which is dependent on the Rohe selected).

The query for Iwi has this criteria: Forms!frmDeceased!cbo_ROHE

When I open frmDeceased through frmMain, I get the 'enter parameter value' message showing "Forms!frmDeceased!cbo_ROHE".

I tried changing this query to: Forms!frmMain!frmDeceased!cbo_ROHE, but it didn't work.

View 14 Replies View Related

General :: Referring To Subform In Navigation Form

Mar 5, 2013

I have an Access 2010 application and I'm having trouble referring to properties in my subform withon a Navigation form. Based on a selection in a Combo Box, I need to change the filter on the subform. The relevant forms are:

Main Navigation Form = frmAdminNav
"Standard" Navigation Subform = NavigationSubForm
My Subform = frmShowInventory

How do I refer to the Filter property on frmShowInventory?

View 2 Replies View Related

General :: List All Open Databases - Referring To Controls On A Form

Jul 17, 2013

Any way to list all currently opened Access databases? It feels like this must be possible by referring to the databases collection, but I just don't know how.

Also, is it possible to refer to controls on a form in one open database from code in another database? (and obviously if so, how?)

View 2 Replies View Related

Forms :: Textbox On Main Form Referring To Subform Control

Aug 14, 2014

I have a form with a subform which resides in a tabbed control. In that subform, I have a textbox in the footer that sums values in the detail section of the subform.

I have a textbox on my main form that should display the same data that is in my subform footer textbox, but it is giving me the #name? error.

This is the expression in my subform footer textbox (which returns the correct result):

TxtSubtotalHQPCalc -
=Sum([ActualHQPCalc])

And the expression in my main form textbox (which returns #name?):

txtActualHQPValue -
=([subfrmHQPProject].[Form]![TxtSubtotalHQPCalc])

I have verified that my subform name and textbox names are all accurate. This is very frustrating because I am using this exact same method in a different database with no problems!

View 3 Replies View Related

General :: VBA Error Referring Control Field In Subform Using Main Form

Feb 22, 2013

I believe I did this before awhile ago but for some reason I keep getting an error.

I have a Mainform (frmMain) that has a Subform (frmSub). On frmSub I have 2 comboxes (strCom1 & strCom2) one is set to invisible (strCom2.Visible = No).

So using the "On Open Event" of frmMain I want make strCom2 visible if strCom1 = "Read Only". Ofcourse I will also need to place the vba on the On After Update event. Below is what I have so far but doesnt work.

I get Run-time Error 2427 "You enetered an experssion that has no value"

Code:

Private Sub Form_Open(Cancel As Integer)
If Me!frmSub.Form!strCom1.Value = "Read Only" Then
Me!frmSub.Form!strCom2.Visible = True
Else
Me!frmSub.Form!strCom2.Visible = False
End If
End Sub

View 5 Replies View Related

Frequent Error In Referring / Linking Textbox In Subform From Text Box Within Main Form

Apr 17, 2013

Go to frmInvoice, and you'll see a Net Total box (txtNetTotal) . It's control source is linked to a textbox in the subform fsubInvoiceDetails2 called txtStocktotal. It basically just pulls up all the costs associated with that InvoiceID.

The reference mechanism is as follows: =[fsubInvoiceDetails2].[Form]![txtStockTotal].Now...sometimes this works and sometimes it doesn't! Sometimes i've had to use: =forms!fsubInvoiceDetails2!txtStockTotal.

It seems to be very temperamental at times and i'm not fully confident if this can be explained.By way of note, I use express builder normally to input these statements: I go to Forms > ALL FORMS > fsubInvoiceDetails2 > txtstocktotal.

View 2 Replies View Related

Continuous Form, Ordinal Index By Function, #Error

Jun 16, 2005

I want the recordnumber displayed on a continuous form. The code below works with the command button, but not afterinsert.

Here's the code: (function GetPosition() is the control source)


Private Sub Command28_Click()
numbers
End Sub

Private Sub Form_AfterInsert()
numbers
End Sub

Private Function getPosition() As String
If Me.RecordsetClone.RecordCount > counter Then
counter = counter + 1
getPosition = "#" & counter
Else
getPosition = "#new"
End If
End Function

Private Sub numbers()
counter = 0
Me.Requery
End Sub


So it should do something like this:

#1 [ctrl 1]
#2 [ctrl 1]
#3 [ctrl 1]
#new [ctrl 1]


But called from after insert only the records on the screen get updated unless I scroll up, so simplified it looks like this:

----------------- top of subform after scrolling up
#3 [ctrl 1]
----------------- top of subform before scrolling up
#1 [ctrl 1]
#2 [ctrl 1]
#new [ctrl 1]


Where else can I put it or how can I modify the code to make it work?
Aidan

View 2 Replies View Related

Referring To A Combobox Value

Jan 4, 2005

hiya..how do i refer to a combobox value from a criteria in a query??
i.e. criteria for a field in query = combobox value in a certain form

View 2 Replies View Related

If Statments And Referring To Other Tables

Sep 25, 2007

I am new to access and am having troubles figuring out if statements. I want an if statement in a table that says if column 1 = "whatever" then column 2 = "YAY" else column 2 = "NO".

How would I apply this to a table?

Also I have a table that has one column it is a list of codes. In another table there are 2 columns column 1 has a code i want column 2 to say if column 1 code is found in the list of codes from the other column the put "MATCH FOUND"

Thanks,
Mike

View 12 Replies View Related

Referring To The Data In Rows Below

Sep 27, 2007

Column A Column B Column C Column D
1*010101001000000 CF 5
010101002000000 RF
010101002000000 RF
010101029000000 CU
1*010101001000000 CF 10
010101351010000 RF
2*010101354000000 CF 11
2*010101354000000 CF 13
010101358000000 CY
1*010101001000000 CF 5
010401328100000 CF


NOTE in the actual data won't be there it is just to show you what I am referring to.

Is there any way in another column in a query to say if Column A repeats itself somewhere else in Column A AND if those two that are repeated both have a "CF" code add column C (which is just an amount for each number)

So for example in this data there are 2 numbers that repeat themself that have CF codes. For these I would need to total them in column D for the first number resulting in:


Column A Column B Column C Column D
1*010101001000000 CF 5 20
010101002000000 RF
010101002000000 RF
010101029000000 CU
1*010101001000000 CF 10
010101351010000 RF
2*010101354000000 CF 11 23
2*010101354000000 CF 13
010101358000000 CY
1*010101001000000 CF 5
010401328100000 CF


Any ideas?

Thanks,
Mike

View 14 Replies View Related

Referring To Columns In A Combo Box ?

Jan 26, 2006

Hello, I am using an IIF statement in my SQL criteria, and was wondering "if" it was still possible to reference a column within a combo box... here is one iif statement

Like IIf(IsNull([Forms]![fSampleSearch]![cboCustomerName]),"*",[Forms]![fSampleSearch]![cboCustomerName])

I want to refer to the third column of cboCustomerName... How would I do this ?

View 8 Replies View Related

Label Name Referring To Subform

Jul 3, 2006

Just a quick question, I can't seem to get this right (as usual :confused: )

I have a form and I want the label in the header to display the text from a field in a related subform. I have tried the following syntax to no avail:
=[Forms]![sfrmCompanyName]![LastName]

Any suggestions

Thanks in advance

Nicolas

View 2 Replies View Related

Referring To A Subform Control

Nov 15, 2004

I know how to refer to a control on a form by using [forms]![formname]![controlname], but can anyone help with referring to a subform.

I have a subform called subPrograms, on which is a combo box whose contents need to be filtered depending on the selection from another combo box on the main form.

The combo box on the main form is cboDivisions.
The combo box on the subform is cboPurchasers
Main form is called frmMain
Subform is called subPrograms

The user is supposed to select a Division, and then depending on that selection the contents of cboPurchasers will change to only show those that are within that same division.

I would also like to know how to update the cboPurchasers when the cboDivision has been selected? Can someon help?

I hope that this is enough info.

View 2 Replies View Related

Referring To Different Record Other Than Current

Dec 8, 2004

Hello,

I'm trying to write a formula/program that will look at a table, look at the date of each record, and sort out and group the records by week (in this case, Sat.-Friday). However, in order to do this, I'm assuming that I must be able to have the program look at, not only the date of the current record, but also the date of the records before and after the current one. What would be the easiest and most efficient way of writing the references? Thanks!

G

View 1 Replies View Related

Referring To The Application Icon Using Code

Jan 2, 2008

Hello all...Happy New Year!!

I have obtained some VB code shown below which adds an icon to the windows task bar as I intend to put some additional code behind this that displays messages near the clock when something happens in the database.
The problem I have is that the code does add an icon but the icon is literally blank. i.e. it makes an additional icon space but does not display any picture.
The code is not actually for VBA so I need to tweak it. I am struggling with telling it which icon to display. Does anyone know how to refer to the application icon using code??

The code I am working on is: (there is also a module but I will post this if you need it.)
-------------------------------

Private Sub AddTrayIcon()

Dim nid As NOTIFYICONDATA

' nid.cdSize is always Len(nid)
nid.cbSize = Len(nid)
' Parent window - this is the window that will process the icon events
nid.hWnd = frmSystray.hWnd
' Icon identifier
nid.uID = 0
' We want to receive messages, show the icon and have a tooltip
nid.uFlags = NIF_MESSAGE Or NIF_ICON Or NIF_TIP
' The message we will receive on an icon event
nid.uCallbackMessage = 1024
' The icon to display
nid.hIcon = frmSystray.Icon
' Our tooltip
nid.szTip = "Always terminate the tooltip with vbNullChar" & vbNullChar

' Add the icon to the System Tray
Shell_NotifyIconA NIM_ADD, nid

' Prevent further adding
cmdAddIcon.Enabled = False
End Sub

Private Sub cmdAddIcon_Click()
AddTrayIcon
End Sub

-------------------------


This is the code that is the problem. I dont think VBA has this function so I need to tell it where to find the .ico file I use for my database.
Thanks folks.

View 2 Replies View Related

Problems Referring To Combo Box For Default Value In Subform

Nov 30, 2006

I want my subform to allow additions. I would like the default value for one of the fields in the subform to be the value chosen in the combo box that is used to select which records are shown in the subform. The row source for the combo box is

SELECT tblLicensee.LicenseeID, tblLicensee.[Licens#] FROM tblLicensee;
where LicenseeID is the key field and Licens# is what is displayed.

If I refer to the combo box for the default value for that control on the form…
=[Forms]![frmFindRecord]![Combo37]

the key value (LicenseeID) is entered as the default instead of the value displayed in the combo box (Licens#). How can I set the default value to record the Licens# instead?

View 1 Replies View Related

General :: Combobox Not Referring To Correct Field

Oct 22, 2014

I have a form which contains fields from my main table and also has a subform containing a query based on a filtered list of my main table.

I have a combobox on the form to select a name and pass it to the query to filter on.

The list of names is in a table called tblnames which has 2 fields, name and ID. I have linked the ID field on this table to a field called nameid on my main table which is a numeric field (and that allows be to select a name from a list when I enter data into my main table.

The xox is unbound, control source empty and row source set to tblname.

The combobox is only showing a list of numbers (I assume they are the id field from tblname). Yesterday I had the list of names showing and I checked a backup and the only difference I can see is the row source property refers to the name field in tblname but I don't know how I got it there. When I click on the list box for row source I only get offered a list of my objects.

View 10 Replies View Related

Modules & VBA :: Referring To Forms Objects Using Variables

Sep 30, 2013

I have a simple date stamp that works great in a private sub within a form. (error handling removed for clarity)

Code:

Private Sub btnDateStamp_Click()
' UserInit is global variable
Me!Notes.SetFocus
Me!Notes = Chr$(13) & Date & " - " & Time() & " - " & UserInit & _
" -" & vbCrLf & Me!Notes

[code]...

I am rewriting it as Module function that is Called from various forms, to save space. The function receives the parameters varFormName and varControlName. I wish to write the results of the function back to a memo field on the form.I am stumped at the get go by the need to refer to the Forms controls with a full reference instead of the Me command.

Code:

Function DateStamp(varFormName As String, varMemoName As String)
'varInitials, varFormName, varMemoName are global variables
Forms!varFormName.Controls!varMemoName.SetFocus ' Error here
'Me!Notes = Chr$(13) & Date & " - " & Time() & " - " & varInitials & _

[code]...

how to refer to the forms control's with their full reference, from within the Module's function, the rest will fall into place.

View 3 Replies View Related

Modules & VBA :: Referring To Calculated Field In A Recordset

Nov 22, 2014

I am trying to use a calculated field in a recordset but I am having problem with the script trying to compile.

my record set is

Set rstPrice = db.OpenRecordset("SELECT Period_desc, Price, Round(Price/7,2) AS Daily_rate FROM qryPropertyPriceList WHERE [Our ref] = '" & rstProp![Our Ref] & "' And [Year] = " & rstProp![Next year price base] & " Order By Sequence", dbOpenSnapshot)

The calculated filed I have added in is Round(Price/7,2) AS Daily_rate

If I let it run just with this it runs fine.

and then I try to use this calculated field:

Do Until rstPrice.EOF
Temp = Temp & rstHTML!html35 & rstPrice!Period_desc & rstHTML!html36 & rstPrice![Price] & "-" & rstPrice![Daily_rate] & rstHTML!html37
rstPrice.MoveNext
Loop
rstPrice.Close ' Tidy up
Set rstPrice = Nothing

They it stops running and it all seems to be because of the Daily_rate field

View 11 Replies View Related

Forms :: Referring To Text In A Table On Subform

Mar 3, 2015

I have a form with a subform that has a table on it. The subform table is a price list with the fields Description, Details (which is hidden as it's too big for the table) and Price.

I want to be able to double-click on a chosen item from the table to display a pop-up showing the same details but with the Details field shown. I have the pop-up in place but I am struggling with displaying the chosen information.

How do I reference the fields on the chosen line in the table?

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved