Modules & VBA :: Search For Record In A Subform

Jun 4, 2015

I have a main form "Furniture_CatCodeAssets" which shows detail specifics about certain furniture item codes (width, height, colour etc.). I have a subform "Furniture_AssetsSubform" which shows all of the asset numbers associated with that furniture item code.I have a combo box that allows you to filter by furniture category, that then updates a list box that shows only the item codes associated with that category. When an item code is selected in the list box the main form and the subform update to show what was selected. (I mention this only in case it is causing an interruption - they work perfectly.)

What I am trying to do now is add a text box and button that will allow you to search in the subform to find a specific asset number and go to that item code on the main form.

I have the following code on the command button:
Set rst = Forms!furniture_CatCodeAsset.Furniture_AssetsSubfo rm.Form.RecordsetClone
rst.FindFirst "[Asset Number]=" & Me.textSearch
If Not rst.NoMatch Then
Forms!furniture_CatCodeAsset!Furniture_AssetsSubfo rm.Form.Bookmark = rst.Bookmark
Else
MsgBox "No match found, please check your asset number and try again."
End If
Me.textSearch = Null
rst.Close
Set rst = Nothing

Which returns the message box that nothing was found even though I know I that asset number exists.

View Replies


ADVERTISEMENT

Forms :: Main Form And Subform Search For Same Record

Nov 20, 2014

I am currently working on a project in access 2010 and I am having a search for record dilemma. I have a main form that has a subform in it under a tab control. I place a search box at the top of the form so that user could select either the ID, the internal case number, and/or the reviewer name in the text boxes to search the record.

I have tried the using the search for record macros and the convert the macros to VBA and possibly write so extra coding for calling the subform into the search but nothing seems to work in getting the search in sync between the main form an the subform. VBA code that will look for same record in both forms.

The reason for the tab control is because depending on the data entered the users switch between mid section data about case and so one set of info goes into one tbl and the other goes into another, but the subform that I am referring to in this question is being generated from the same tbl as the main form.

View 2 Replies View Related

Modules & VBA :: Delete Of A Record From A List Of Records In A Subform Deletes Wrong Record

Jun 28, 2013

When we browse through records in a subform we store the records in the database.When we want to delete a records for example the third record from the five records always the first records will be deleted. How can we delete the records where the cursor is at? When we are at the third record and press the delete button the third record from the list in the subform should be deleted.

Code:

Option Compare Database
Dim FocusBln As Boolean
Private Sub Identificeer()
Me.[Datum Aangemaakt].Visible = True
Me.[Datum Aangemaakt].SetFocus
If Me.[Datum Aangemaakt].Text = "" Then

[code]...

View 11 Replies View Related

Modules & VBA :: Search For A Record In Excel

Jun 5, 2014

I have recently built a database to keep track of all the inventory counts for our technicians. This process was originally in Excel and they wanted to move it to Access in order to automate it. They have also decided that they still want to maintain the original Excel schedule by adding dates each time a step is completed. I currently have code that will go to an existing spreadsheet and add data from the database URL... I was wondering if there is a way to modify this code so that it will look for a specific name in the spreadsheet, go to the end of that row and enter today's date.If so, what modifications would need to be made to the code to get it to work?

View 1 Replies View Related

Modules & VBA :: Unable To Search A String Within Subform To Find Information Stored On Main Form

Dec 2, 2013

I'm trying to search a for string within a subform to find information stored on the mainform to which the particular subform belongs.

The problem is that the subform is generated from a query which uses a number from the main form to generate.

So the subform record is only generated when the correct mainform record associated with it is loaded.

Now to solve my problem I've made a new query that brings up ALL the results that could be generated by the main form and from that I can search to find my search term I'm after and read off the ID number to tie it back to the mainform.

But all of this is done manually, I want a way to do all this using VBA in a way that the user can't edit any records as they are doing it.

View 3 Replies View Related

Modules & VBA :: Possible To Msg Box Record From Beginning To End Of Record In Subform

Jun 23, 2015

I have 5 subform named "bene_subform1", "bene_subform2", "bene_subform3", "bene_subform4", "bene_subform5", and i would like to know if it's possible to msgbox the record from the beginning to end of record in sub-form 1, loop thru all the 5 subform via VBA?

View 14 Replies View Related

Modules & VBA :: Input Box Search - Find A Record In Main Form

Jun 5, 2014

Input box Search problem. I have been using the following to find a record in my frmMain using an Input Box:

Private Sub cmdClientIdSearch_Click()
'Searches for Client by ID number
Dim rs As Object
Dim strCriteria As String
strCriteria = InputBox("Please enter Client ID" & vbCr & "Do not type leading zeros")

[Code] ....

It works great if I run it from a command button from frmMain. But, if frmMain is open and I run it from a command button on my switchboard, I get the following error message:

Run Time error 7951. You entered an expression that has an invalid reference to the Recordset Clone Property. I tried inserting a command to open frmMain in the first line, even before the two Dim statements, but I get the same result.

View 6 Replies View Related

Modules & VBA :: Creating A Search Form With Ability To Add Found Record To Table?

Aug 7, 2013

creating a VBA that will allow me to search for a record in Table A, and once the record is found, allow me the option to add that record to Table B. Is this possible to do if Table A and Table B are not formatted the same (i.e. one has more fields than the other)? In summary, creating a VBA that will allow me to search in one table and once the correct record is found, allow me the ability to add it to another table.

View 7 Replies View Related

Using Subform For Search Criteria And Relating One Search Field To Several Columns

Apr 21, 2015

1. I created a form with some search-fields which are related to a query. Then I added a Subform in which I put some more Search criteria (So that I can easily hide and unhide those additional searchfields). It sounds strange but is necessary ;-). Now I related those searchfields in the subform to the same query. When I run that query a window pops up that I should put in a value in all those searchfields which are in the subform. But I told Access that it should display all rows, if there is no value in those searchfields. Just as I did it with the Searchcriteria in the Main form. Do I have to do something special, when I have a query which is related to two Forms?

2. I want a searchfield to search in three different columns. Usually the value will just be found in one of those columns. As the Table I search is very long and has many searchfields and multiple of those will relate to more than one column, is there an easy way to do it in VBA? As I did it by using the "or" field when designing a query, but this seems very slow and unstable.

View 6 Replies View Related

Modules & VBA :: Go To Record From List Box On Subform

Aug 12, 2014

My main form has a union query as it's record source. This displays a list of items for which the user uses this form to apply a category for each of the items. This relationship of item to category is stored in a temporary table. I have a subform with a list box that shows the current selections and is based on the temporary table. The linking of the master and child is based on the "description" field. I would like the user to be able to select one of the items in the list and have the main form go to that record. (the list box has multiselect set to none).

View 14 Replies View Related

Modules & VBA :: Force Subform To Be Opened On First Record

Aug 20, 2013

I have an issue with my subform, that when opened inside the main form, I want the form to be opened on its last record (which works) and then I want the subform to be opened on the first record regarding that record ID coming from from the main form. The relationship is many to one, coming from the form to the subform. I have tried several code on many events on the subform so it can goes to the first record, but it sometimes goes to the first, othe times ot goes to the third, i don't know why. I have tried the following:

Private Sub Form_Load()
DoCmd.GoToRecord , , acGoTo, 1
En Sub

or
DoCmd.GoToRecord , idsPreguntas, acFirst 'idsPreguntas is the control name of the record

or
DoCmd.GoToRecord , , acFirst

View 8 Replies View Related

Modules & VBA :: Copy Subform Recordset To New Record

May 8, 2015

I am trying to copy a subform record set from one record to the next record. The data in the main table is copied over using this method;

Code:

Dim v1 As Variant
Dim v2 As Variant
Dim v3 As Variant
Dim v4 As Variant

v1 = Me![Today's Date].Value
v2 = Me!Insured.Value

[Code] ....

Can I integrate the copying of the subform data to the new record with this or do I need something different, and if so what?

It's a many to many relationship and I've tried adding the following line to the code:

v5=Me![Endorsements Umb XS].[UmbID]
same=v5

and it works but it only copies the first record out of the set.

View 14 Replies View Related

Modules & VBA :: Editing Existing Record Using Subform

Jan 8, 2015

I'm successful in adding data from the form to the table using VBA. But I couldn't retrieve and edit the data. For retrieving and editing the data I have a different form "[Forms]![Editor]". I have all the fields listed in the image in both the form and table.

1. I want to allow the user to search and retrieve a specific row based on the condition Incident ID and the Package code are same
2. I want the user to edit the fields in the form and update it in the same row again.

View 2 Replies View Related

Modules & VBA :: How To Enter A Record In A Table Via Subform

Sep 18, 2013

I have a main form with several tabs. Each of those tab has one subform linked to its related table. I would like to be able to enter a new item in one of the table via the subform and I used the following code:

Code:
Private Sub Form_Load()
DoCmd.GoToRecord acDataForm, Me.tblEmetteurs_AddItems_subform.Name, acNewRec
End Sub

I obtain a msg error from the debogger: "Compile error: Method or data member not found."

View 6 Replies View Related

Modules & VBA :: Increment Record Default Plus 1 In Subform

Jun 29, 2015

User enters data relevant to placement on data card, in series of 20. Sometimes record lines are skipped on card, meaning user needs to be able to override default value, and then have code +1 for next record. For the output I need, Autonumber won't work, Recordsetclone won't work.

example columns:
weight/length/record

VBA code is set:

Private Sub record_BeforeUpdate(Cancel As Integer)
Me.record.DefaultValue = Me.record + 1
End Sub

User keying in a number activates the code, but won't recognize the default number.

weight length record
34 34 1 <----user enters
34 34 2 <--- auto populates from code
34 34 2 <---- auto populates from code, doesn't recognize previous record default set from code to output 3.

Any way to achieve the output I want?

View 3 Replies View Related

Modules & VBA :: Delete A Selected Record In A Subform By Using A Button

Jan 12, 2014

For school I have to make a application in access how to delete a selected record in the table in a subform by using a button. The subform is in the main form and the button is also in the main form

View 14 Replies View Related

Modules & VBA :: Find Record In A Subform / Getting A Runtime Error 438?

Feb 26, 2015

I have an unbound form: frm_ReceiptSearch with some fields that, when something is input, will search a datasheet viewed form on a subform on the main form (subform name is sf_frm_Receipts). Currently, on the txt_CheckNo field's after update event, I have the following code:

Private Sub txt_CheckNo_AfterUpdate()
Dim SrchVar As String
SrchVar = Me.txt_CheckNo
Me!sf_frm_Receipts!REFNO.SetFocus
DoCmd.FindRecord SrchVar, acEntire, , acSearchAll, , acCurrent, True
End Sub

but I'm getting a runtime error 438.

View 4 Replies View Related

Modules & VBA :: Adding New Record To Related Table In SubForm

May 13, 2015

I am currently working on an Access Database that houses our security clearance information. Most of the system is up and running but the most recent form has got me spinning my wheels. I have a Word User Form that users will download and complete, once completed the macros will automatically send us the document to be added to our database. Most of this is working the problem is that this portion of the database has multiple related tables and at any given time a user may require multiple records in the related tables. I have created the code to copy most of the information but am getting stuck adding a new record on the sub-form when multiple items are required. Here is a breakdown of the scenario

Word Doc Table 1 = Basic Organization Info
Word Doc Table 2+ = Sites to Visit (There could be more than 1 table added here)
Word Doc Table 3+ = People to go on site (this might not be the third table based on user interaction for sites)

So far I can get Table 1 and Table 2 data but if there are more than 1 site I cant seem to get the system to create a new record on the related table it is creating a new record on the main form. Here are the lines I used to try to create the related record..

Me.RFV___Agencies1.SetFocus
DoCmd.GoToRecord , , acNewRec

When I put just the above code on a button it seems to have worked as the sub-form showed an additional record was created but when using this on my macro the sub-form is not taking the focus for some reason.

View 1 Replies View Related

Modules & VBA :: Unable To Create Duplicate Record On Subform

Nov 29, 2013

I am trying to create duplicate records from a main form frmManagers which has a subform frmSubMeasure. I have placed the duplicate button on the main form. It creates a duplicate of the main form data and gives me the option to add new record to the sub. I want the duplicate to be created on the sub form for me to just edit the scores.

I don't know how to pass the sub form data to be duplicated I thought the append query which I used would update the tblSubMeasure table which created the subform frmSubMeasure.
In the sub the append query do update the form with the new MeasureID from the mainform and the form is available to enter new data. I want the subform data to be duplicated as well

In the query I included all the fields from the tblSubMeasure table and this is appended to the same table tblSubMeasure and I place a tag on the MeasureID using "[Forms]![frmManagers].[Tag]"

Code:
Private Sub btnDuplicate_Click()
Dim dbs As DAO.Database, Rst As DAO.Recordset
Dim F As Form
'Return Database variable pointing to current database.
Set dbs = CurrentDb
Set Rst = Me.RecordsetClone

[Code] .....

View 1 Replies View Related

Modules & VBA :: Data Filtering By Form / Subform Using Same Record Set

Feb 26, 2015

I have a form and subform where i have table data in the subform and 03 Combo box in the main form header. I need to do some filtering using combox box1 and out of that filtered records i need to do one more filtering using combobox2. then again another filtering by Combobox3. ( same way we are doing in Excel)

Subform is running on a query where i have following fields;

Vessel
Voyage,
POL
POD
MLO

by Combo box 1 i need to filter Voyage
by Combo box 2 i need to filter POL ( out of the data filtered by above )
by combo box 3 i need to filter POD ( out of the data filtered by both above )

View 3 Replies View Related

Modules & VBA :: Record Specific Images On Tabular Subform?

Jul 12, 2015

I'm trying to make a field specific image on a tabular subform, so a different image appears on every row depending on the field information.

Currently my code displays the same image on every row depending on which subform row is selected:

Code:
Private Sub Form_Current()
Dim imagepath As String
imagepath = GetImagePath & Me.Exercise & ".jpg"
If Len([Exercise]) > 0 And Len(Dir(imagepath)) > 0 Then
Image26.Picture = imagepath

[code]......

View 1 Replies View Related

Modules & VBA :: Event That Trigger On Selecting A Record Of Subform

Jun 30, 2014

I've got a subform that im writing code for, once a user enters a value in one of the fields i want to make sure they cant change that field (and two other fields in that same record, though the rest of the fields are fine to edit at will)

I've got a function already written to validate the data in the record and decide whether or not the fields are enabled and disabled, however im having trouble finding an event in which to activate the function

Is there an event that triggers whenever a user selects a different record?

Any chart or list with all the handlers and how they trigger (in relation to each other) and when?

View 1 Replies View Related

Modules & VBA :: Highlight Entire Record In Subform As List Box?

Aug 31, 2013

I would like continuous subform as a list box in my file. Now when click fields on my form the entire record will not be highlighted. In the sample I have found from the net when click on each field in the form entire row will be highlighted. So I try to using function in the sample for my own but it does not work and when I click on each field just that field in 1 second will be highlighted and entire row will not be highlighted.

Private Sub P_ForceHighLight()
On Error Resume Next
Dim ct As Control, ct1 As Control
DoCmd.Echo False Set ct1 = ActiveControl
For Each ct In Me.Detail.Controls ct.SetFocus

[Code] ....

View 1 Replies View Related

Modules & VBA :: How To Automatically Set Cursor To First Record (in Subform Of A Tabcontrol)

Oct 31, 2014

All I have a form called frmMain. This form contains a TabControl named tabMain tabMain has some pages. One of the pages is called pagRecords pagRecords contains a subform called frmRecords. frmRecords contains records from an in-memory table.

My problem: If I select tab pagRecords the cursor is set to the last record.

What I want: as soon I select tab pagRecords, the record cursor must always be set to the first record.

I think this can be done with next code.

Code:

DoCmd.GoToRecord acActiveDataObject, , acFirst

However, I placed this line in a lot of event properties but it is never triggered (I put a break on the line).

So on which object and event should I put this line? (and is acActiveDataObject the right parameter?)

View 2 Replies View Related

Modules & VBA :: Invoice And Subform - Add Multiple Record (Item) At Once

Mar 23, 2014

I almost complete my mini project - Stock Inventory:

To track Items enter and exit from Videoshop or simply known as Stock Transaction (IN/OUT). This also include a Inventory Catalog which basically show all the Items in the Videoshop, each Items details including category, transaction type description and most importantly quantity on hand.

As mentioned above, I almost complete the database except the most important Form - New Stock Transaction where User enter all the necessary details to issue an IN or OUT Transaction. To make things easy to understand, it share many similarity with Invoice and New Order.

Code:
Main Form (Table: StockTrans)
Trans_ID
Trans_Type
Trans_Date
Trans_Cust
Trans_Note

Code:
SubForm (Table: StockTrans_Items)
Trans_ID fk
ItemID fk
Trans_Item_Qty

When I finished records entry and enter Invoice completed button then it will auto update the Item Quantity on Hand.

View 1 Replies View Related

Modules & VBA :: Creating New Record Within Subform - Cannot Navigate To Other Active Records

May 4, 2015

I have a main form that controls 2 subforms. sbfActiveProjects displays a list of records that have not been flagged as complete. Upon clicking on a record in sbfActiveProjects, the details of that record show up in sbfProject. This functionality works great, except when I try to create a new record. The code works fine for getting a new record, however once I run the command I lose my ability to navigate to other active records.

Code:
Private Sub cmdNewProject_Click()
'set focus to sbfProject
sbfProject.SetFocus
'navigate to new record
DoCmd.GoToRecord , "", acNewRec
End Sub

View 2 Replies View Related







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