Modules & VBA :: Cannot Instantiate Child Recordset

Jun 17, 2013

I am trying to open a child recordset but keep getting Error 424 "Object required".

Dim rstEmails As DAO.Recordset2, DBS As DAO.Database, rstFile As DAO.Recordset2
Set DBS = CurrentDb
Set rstEmails = DBS.OpenRecordset("Beldenemails")
Set rstFile = rstEmails.Fields("email").Value 'Error 424 here
End Sub

I've tried everything I can think of.

View Replies


ADVERTISEMENT

Modules & VBA :: How To Extract Recordset From Subform Into Recordset Object

Aug 14, 2015

Special situation: The SQL Server Linked Server across the country is linked to a Read Only Oracle DB. This data pull works perfectly and populates the Subform.

The problem is that Oracle can take 3 to 6 seconds to retrieve the single record depending on the network traffic through a small pipe.

The code below shows the RecordSource for the SubForm. clicking on a list box supplies the value. Then 3 to 6 seconds later, the subform populates.

The actual Recordset for this Recordsource is needed to conduct Validation on each field. Normally this would be on SQL Server, I might just create a Recordset Oject and run this SQL statement again in 1 milisecond. In this case, it will probably take an additional 3 to 6 seconds. Avoiding another lengthy round-trip to Oracle would be prefered.

Goal: How does one grab, clone, or other wise reference the existing recordset for the SubForm?

Note: Immediate Window - One single field can be returned quickly

There are 48 fields that need validation - is there a way to reference the entire recordset?

Immediate Window during Break Mode:
? me.fsubsrNavSHLBHL("NavSH_QQ")
NESE ' this is the correct value for the current recordsource

Set a breakpoint right after the line:
fsubsrNavSHLBHL.Form.RecordSource = "Select * from vsrNavigatorSHLBHL where Well_ID =" & txtNavWellID.Value

Immediate Window:
? me.fsubsrNavSHLBHL.Form.RecordSource
Select * from vsrNavigatorSHLBHL where Well_ID =91229

View 4 Replies View Related

Modules & VBA :: Can Use Result Of One Recordset For Other Recordset

Jul 7, 2013

I want to write a email where there are 2 or 3 different ordernumbers for same email, i want to include the email in the mail part as single column table. how to do it? also can i use result of one recordset for other recordset?

View 1 Replies View Related

Modules & VBA :: Can Filter Child Subform From Parent Form?

Jun 11, 2013

I am updating an existing database and I have a parent/child form and I want to filter the subform for the current parent form record? The two forms are linked together by woWorkOrderID/deWorkOrderID.

View 1 Replies View Related

Modules & VBA :: Parent Table Revision History - Insert Multiple Records Into Child Table

Sep 8, 2014

I have a parent table (tblLabels) and a child table (tblRevision) where the revision history for the parent table is kept.

The parent table is populated via an excel import and may have several records imported at once. Instead of having the user manually enter a new record note in the child table for each record imported into the parent table, I've created a form that collects the necessary data (date, person who added the record, person who authorized the record, and notes) and then creates a revision history for each new record.

This is what I have so far:

Code:

Private Sub cmdAddNotes_Click()
Dim strSQL As String
Dim RevisionDate As String
Dim RevisionRevisedBy As String
Dim RevisionDesc As String

[Code] ....

When I run the code nothing happens. No error, no new records create, etc. My suspicion is that I may need to use an INSERT INTO query instead of an UPDATE query, but I'm not sure how to go about matching up the foreign keys if that's the case.

View 14 Replies View Related

Modules & VBA :: EOF Is Not Being Recognized In Recordset?

Mar 18, 2014

I have a form with a query set up as the record source. If there are records in this query, the form will display. When the user clicks a button, if there is another record in this query, the form displays the next record. When it gets to the EOF, it should close this form, but EOF is not being recognized (I run debug and it says it's false when the button is clicked)? I get run-time error '3201' after I click the button twice.

I know for a fact that there are 2 records in this query. So once I click the button on the 2nd record, the form should close.

Code:
Private Sub SelectTblMyMedButton_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("qryMedDataSelect", dbOpenDynaset)

[Code] .....

View 3 Replies View Related

Modules & VBA :: Looping Through A Recordset

Jul 8, 2014

I have learned the basic looping technique for going through a record set from the following link. I need to know if my logic is on the right track. URL...

My question is a followup to a thread that was opened on this forum: URL....I want to do the following:

1) Use record set looping technique to fix a variety of incorrect naming conventions to a standard format
2) Update the table (or create a new table) from the updated record set values. (Is my logic going to update the table selected in the code I used to dimension the record set or will I need to do something else to make the changes available for other tasks after record set is closed ? After the naming conventions are fixed this data will be available for excel automation that I am working on and posting questions on another thread in this forum. HAHA I'm going code BANANAS)
3) rs.fields![fleetlocation] is used so many times, how can I make this a variable (what do I dimension the variable as?)
4) Use an AND statment with an if statment (how to do this with correct syntax)

Code:
sub loopandfix()
on error goto errorhandler:
strSQL = "tblUnionQueryResults" 'table was created from a union query but has inconsistant naming conventions for the fleet location name

[code]....

View 9 Replies View Related

Modules & VBA :: Loop Through SubForm RecordSet?

Jun 4, 2014

Is there a way of looping through a non update able continuous subform, and using information from each line.

Which creates a new record in another table? so if there are 3 records in the subform it creates 3 new records in the other table and so on?

View 3 Replies View Related

Modules & VBA :: Extracting A Field From Recordset?

Nov 11, 2014

Is there a possibility to use a shorter code for extracting one field from one record, than opening a recordset, getting the field, closing it and setting the recset to "Nothing" again? I'm doing this multiple times in my code and it seems a bit too much for what it's supposed to do.

Code:
sql = "SELECT tblAdFlgDaten.* FROM tblAdFlgDaten WHERE (((tblAdFlgDaten.AuftrID)=" & ABAuftrID & _
") And ((tblAdFlgDaten.Schritt)=2))"
Set RSnap = dbase.OpenRecordset(sql, dbOpenSnapshot)
If IsNull(RSnap.Fields(2)) Then
...
...
End If
RSnap.Close
Set RSnap = Nothing

View 4 Replies View Related

Modules & VBA :: How To Remove ADO RecordSet From ListBox

Aug 6, 2013

How does one go about removing a recordset from a ListBox?

I have a list box that I want to toggle between using a query and an ADO RecordSet to populate the values.

Once I set the listbox .RecordSet property to the ADO.Recordset, I can't remove the values displayed in the listbox when I assign a query to the .RowSource property.

I suppose I can turn the .RowSource query to an ADO Query but I am being lazy and don't want to rewrite the query as a T-SQL query.

I previously thought the list box was pulling data from the .RowSource query but I realize I was wrong.

View 1 Replies View Related

Modules & VBA :: Create Recordset From List Box

Sep 3, 2014

Is it possible to create a record set from a list box?

I have two list boxes list1 (customers) the can transfer records to list2. I want to take all records from list2 and use it to open a report, using customer id as where clause in my docmd.openreport statement.

View 4 Replies View Related

Modules & VBA :: Drop Down List From Recordset

Aug 21, 2013

As I am moving through my code, I'd like there to be a pop-up box which asks the user to choose from a list of dates. This list of dates only resides in a filtered recordset in the background.

Once the date is chosen, then my code continues onward..I know I could make some sort of pop-up form, but I'd rather not have to go in a design all that just for a list of dates...

1) Is there such a thing as a dropdown list on a Input box?

and even if there isn't...

2) Is there a way I can bind the column in a recordset to a dropdown list?

View 2 Replies View Related

Modules & VBA :: Looping Through Form Recordset And Looking Up Value

Jun 18, 2014

Im still struggling with working with recordsets.What i want to achieve is to loop through a continuous form recordset, Using the OrderDetailFK from the record set and the OrderDetailPK in the OrderDetail Table

Looking at the Status FK in the OrderDetail Table. IF the OrderDetail Status = 2 then i want to make the textbox enable property = False. I have made the bellow SQL string which is placing all the criteria i just need to link it into a recordset?

Code:
mySQL = "SELECT [StatusFK] FROM [tblOrderDetail] WHERE [OrderDetailPK] = " & rst!OrderDetailFK & " AND [StatusFK] = 2 "";"""

View 4 Replies View Related

Modules & VBA :: Query Object To Recordset

Oct 14, 2013

I am in the middle of creating a function that populates two unbound text boxes on a form and then uses those unbound textboxes in a query (Total of 3 unbound text boxes - 2 are populated from this function). The saved query object is working fine when I manually execute it (after the unbound text boxes have been populated). However, when I go to set the same query to a recordset I am getting the "Too Few Parameters. Expected 3." error message.

In the saved query I used the build function to use the unbound text boxes as part of the where clause. Below is the code I am trying to execute:

PHP Code:

Public Function Test()Dim db As DAO.DatabaseSet db = CurrentDbDim rst As DAO.Recordset
Dim DtBegin As String''FInd the Begin dtstBegin = DateAdd("q", -1, DateSerial(Year(Date), (DatePart("q", Date) - 1) * 3 + 1, 1))
Dim DtEnd As String''find the end dateDtEnd = DateAdd("Q", DateDiff("Q", 0, Date) - 1, 0)

[Code] ......

The unbound text boxes are populated before the query is set to the recordset.

View 5 Replies View Related

Modules & VBA :: RecordSet - Nothing After SQL Query Returns Value

Jun 11, 2014

I'm trying to assign the result of an SQL query to a variable using VBA in Access. The query returns a value but the variable which it is assigned to has a value of Nothing. Here is the code snippet:

Dim queryReturnID As String
queryReturnID = "select dbo_tbl_SupplierReturn.ReturnID from dbo_tbl_SupplierReturn" & _
" where SupplierID = " & lstPOHdr.Column(1)
Debug.Print queryReturnID
Dim RecordSet1 As DAO.RecordSet
Set RecordSet1 = CurrentDb.OpenRecordset(queryReturnID)

View 3 Replies View Related

Modules & VBA :: Why RecordSet Not Starting From Record 1

Sep 1, 2014

Why my Recordset start from record # 301 instead of # 1 Here's part of my code:

Set db2 = CurrentDb
Set rst2 = db2.OpenRecordset(strTable2)
If rst2.RecordCount = 0 Then
MsgBox "No records to process."

[Code] ....

Table has 12,000 records and the first record has an ID of 1. So why is it starting from the record 301? What am I doing wrong?

View 3 Replies View Related

Modules & VBA :: Using Recordset Inside SQL Statement?

Jun 19, 2015

Is it possible to use recordsets inside an sql-statement how described in following example. the error message: access can't find the table or querydef.

Code:

public function useRS (RS_ext_1 as DAO.Recordset, RS_ext_2 as DAO.Recordset) as DAO.Recordset
dim sql_RS_int as string
dim RS_int as DAO.Recordset

sql_RS_int = "SELECT * FROM RS_ext_1, RS_ext_2 WHERE col1_ext1 = 1 and col1_ext2 = 5"
set RS_int = CurrentDB().OpenRecordset(sql_RS_int)
set useRS = RS_int.Clone

end function

View 6 Replies View Related

Modules & VBA :: Loop Recordset With IF Greater Than?

Jun 16, 2014

Im trying to create a record set that compares a quantity value in the recordset to a Value in a temporary table that holds the most recent remaining quantity. I have the following code in the after update of a text box, but it does not trigger. I want it to run after a value is entered into the text box. Is the code wrong or the location im putting it incorrect?

Code:
Private Sub txtQty_AfterUpdate()
Dim rs As DAO.Recordset
DoCmd.OpenQuery "qryQuantitySoFar"
Set rs = Forms!frmReceive!sfrmReceiveDetailEntry.Form.RecordsetClone

[Code] ....

View 11 Replies View Related

Modules & VBA :: Using Access Recordset As SQL Variable?

Jan 16, 2014

I am trying to create a process which selects a customer's site identifier and uses that to query an Oracle database through an ADODB connection. Which is all well and good until that customer has more than one site.

Here is a simplified version of what I have created:

Code:

'Get site details from current database on basis of company selected on form

Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
Dim RsSites As New ADODB.Recordset
RsSites.ActiveConnection = cnn

[code]....

As I said, this works perfectly when the customer only has one site, but I have failed to find a way to turn a recordset with multiple values into a SQL variable that can be used in the IN clause.

I have attempted to convert the recordset to a string using GetString, but could not find a way to correctly seperate out the records.

View 5 Replies View Related

Modules & VBA :: Using Recordset To Work With Query

Dec 15, 2014

I want to use Recordset to work with query but get the error "Run-time error '3061' too less parameters. Expected one".

Code:
Dim rst As Recordset
Dim strSQL As String
Dim krojenie As String
strSQL = "SELECT * FROM powtorzeniaDoKrojenia"

[Code] .....

View 3 Replies View Related

Modules & VBA :: Opening ADODB Recordset

Jul 2, 2013

I'm building a lab environment into one of my projects. I'm testing the distribution of values over a largish number of attempts to create a unique value.I have a table called LAB_UniqueIDTest, with two fields:

LAB_ID - the string value being tested, and
LAB_UsageCount - the number of times the value has been created.

I'm trying to open the table using the following code:

Code:

' Initialize access to the LAB_UniqueIDTest table
Set rs = New ADODB.Recordset
rs.Open "LAB_UniqueIDTest", _
CurrentProject.Connection, _
adOpenKeyset, adLockOptimistic

I have similar snippets of code all over the application - either with a literal (as here) or as a string parameter.I do not, ever, use the options parameter of rs.open.I get error message "Run time error -2147217900 (80040e14) Invalid SQL statement - expected DELETE, INSERT, PROCEDURE, SELECT or UPDATE

My guess is it's because somehow the Open procedure is trying to interpret the tablename as a SQL statement. But how come it isn't this obtuse at other times?

View 6 Replies View Related

Modules & VBA :: Open RecordSet For Combobox

Apr 8, 2015

How to open a Record Set For the combo-box? My Original Code as follows

Dim conn As New ADODB.Connection
Dim objMyRecordset As New ADODB.Recordset
Dim strSQL As String
Set conn = New ADODB.Connection

[Code] ....

After i use this code nothing come out on my combo-box...

View 2 Replies View Related

Modules & VBA :: Passing RecordSet As A Parameter

Sep 19, 2014

I'm trying to the following sub to automate the creation of RecordSets but I'm confuse how to get it done properly.

Public Sub OpenRecordSet(SQLString As String, NameRecordset As Object)
Set NameRecordset = New ADODB.Recordset
NameRecordset.Open SQLString, adOpenStatic, adLockOptimistic

I want to pass the name of the recordset as a parameter but I don't know how to set it.

View 1 Replies View Related

Modules & VBA :: Lookup A Record In Recordset

Oct 17, 2014

I am trying to lookup a record in a recordset. If no match is found then run an append query. I am having trouble coding the findfirst syntax.

Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim WO As String
WO = Forms!frmdsh_workorder!txtWO
Set db = CurrentDb

[Code] .....

When I run the Function, it throws a RT error #3077 on the .findfirst line. (Syntax Error (Missing Operator) in expression. )

View 3 Replies View Related

Modules & VBA :: Clearing A Combobox Selection Not Whole Recordset?

Jan 31, 2014

I would like to be able to clear a combobox selection with code but nothing I have tried is working.

Most recently I have tried this:

Code:
Me.cboCompanies.ListIndex = -1

To no avail. The selection still remains highlighted in the control after the code is executed. I want the control to be blank. Also the control goes from being a combo box to a text box until escape is pressed and it is cleared

I have also tried using a simple Undo and that is not working either.

View 8 Replies View Related

Modules & VBA :: Opening A Recordset Based Upon A Variable?

Jul 5, 2013

Simple example is I have say 3 recordsets open (they are opened once as they are refered to many times) - they are open early in the form (in this example 3 price lists that are applicable for a customer) (if the syntax of the select is slightly wrong I'm just showing to 'prove' the concept).

Dim db As Database
Dim rs1 As Recordset
Dim rs2 As Recordset
Dim rs3 As Recordset
Set db = CurrentDb()
Set rs1 = db.OpenRecordset("SELECT * FROM Prices WHERE (((Prices.ID)=1));")
Set rs2 = db.OpenRecordset("SELECT * FROM Prices WHERE (((Prices.ID)=2));")
Set rs3 = db.OpenRecordset("SELECT * FROM Prices WHERE (((Prices.ID)=3));")

What I want to do is have a central function that I can pass a list I wish to process/do something with aka. The 3 recordsets are the same except for the where criteria.

private sub GETPRICEFROMLIST(pricelist as long)

dim rs as recordset

set rs = Recordset("rs" & pricelist)
.....

I put the above to show what I'm trying to do but of course that doesn't work There won't be any updates to these recordsets only reading of data.

View 6 Replies View Related







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