I Just Want To Create A Recordset (Runtime Error 424)

Jul 21, 2007

Why does the following code generate an error. All i want to do is open a recordset which I thought would be straightforward. (novice Programmer, new to access vba). The set statement in the ComboProduct event generates the error.

Option Compare Database
Dim Company As String
Private dbaProposal As DAO.Database
Dim EffectiveDate As Date
Dim Product As String
Private rstProposal As DAO.Recordset

Private Sub ComboProduct_AfterUpdate()
Product = ComboProduct.Value
Set rstProposal = dbsProposal.OpenRecordset("SELECT * FROM Proposals WHERE Proposals.[Group Name]='" & Company & "' AND Proposals.[Effective Date]=#" & EffectiveDate & "# AND Proposals.Product='" & Product & "'")
End Sub

Private Sub Form_Load()
Set dbsProposal = DBEngine.OpenDatabase("Database1.accdb")
End Sub

View Replies


ADVERTISEMENT

General :: Open Recordset With A Query That Uses Reference To Form Control - Runtime Error 3061

Aug 2, 2012

I'm trying to open a recordset in vba and I'm getting the 3061 runtime error,Expected 1.

I'm trying to open a recordset with a query that uses a reference to a form control.

Code:
searchtable1 = "qInVisio_RSV"
Set rs = db.OpenRecordset(searchtable1, dbOpenDynaset, dbSeeChanges)

This is the sql of the query:

The highlighted parted is the form referance ( I know it's obvious, just for easier spotting )

Code:
SELECT dbo_FOLIO.FOLIOID, dbo_FOLIO.KIND, dbo_FOLIO.RSVID, dbo_FOLIO.CHKIDATE, dbo_RLIST.ROOMID, dbo_ROOM.ROOMNO, dbo_AGN.LINAPRG
FROM (dbo_ROOM INNER JOIN (dbo_FOLIO INNER JOIN dbo_RLIST ON dbo_FOLIO.RSVID = dbo_RLIST.RSVID) ON dbo_ROOM.ROOMID = dbo_RLIST.ROOMID) LEFT JOIN dbo_AGN ON dbo_FOLIO.AGNID = dbo_AGN.AGNID
WHERE (((dbo_FOLIO.KIND)=101) AND ((dbo_FOLIO.CHKIDATE)>=[Forms]![frmCleaningPlan]![DTPicker]));

also as you can see it's a datepicker control, so the value is a date...

View 2 Replies View Related

Queries :: Runtime Error 429 - ActiveX Component Can't Create Object

Jul 26, 2013

I'm using the below code in msaccess which used to work perfectly on the Win XP platform. I upgraded my OS to Win 7. It's now giving an error as "Runtime Error 429 - ActiveX Component Can't Create Object". I unchecked & rechecked all the library references.

Function GetNetWorkDays(startDate As Date, endDate As Date) As Integer
Dim objFunction As MSOWCFLib.OCATP
Set objFunction = New MSOWCFLib.OCATP
GetNetWorkDays = objFunction.NETWORKDAYS(startDate, endDate)
Set objFunction = Nothing
End Function

Old OS: Win XP
New: Win 7
Old msaccess: 2003
New: 2010
Old office: 2003
New: 2010

View 6 Replies View Related

Create A Recordset From A Recordset

Aug 17, 2007

from a table with fields userID and Date (in which any userID has multiple records with different Date values, and other fields) i have built a select query based on Date = one specific value. can anyone give an explanation (for beginners), through a sample code, that expands the query recordset so that the new recordset includes all records per userID that qualified in the prior recordset? below is an example. thank you!

Table with records:
userID / Date
u1 / d1
u1 / d2
u2 / d1
u2 / d2
u3 / d2
...
1st Select Query (where Date = d1):
u1 / d1
u2 / d1

Desired 2nd Query based off 1st Query (where ?):
u1 / d1
u1 / d2
u2 / d1
u2 / d2

View 3 Replies View Related

Active X Cant Create Object In Access2000 Runtime

Jun 7, 2007

Hi, i am using the following code to open another access database. it works fine in fuilltime but when i install a runtime version I get an 'active x cant creat object' error. Does anyone knwo why this is?

Dim appAccess As Object
Const strPathToBackup = "C:interim.mdb"
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase strPathToBackup
appAccess.Visible = True 'do not show database
appAccess.Run "Test"
appAccess.CloseCurrentDatabase

Cheers

Tania

View 11 Replies View Related

SQL ERROR - Runtime Error 3061 -

Aug 5, 2005

SQL Issue ...

ERROR: Runtime error 3061 - Too few parameters. Expected 1.

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

Not sure how to work in the '* ROLL *' into this SQL statement. The query statement works fine ... I have tried different quotation methods ( Not Like " & " '
* ROLL * & ' " & " ) AND .... )

sql = "SELECT DISTINCTROW Sum(CDbl([Scrap Factor])) AS SumOFScrap FROM [RT: Signpro1: Costs] LEFT JOIN [DT: InventoryExtend] ON [RT: Signpro1: Costs].[Part Number] = [DT: InventoryExtend].[Part#] GROUP BY [DT: InventoryExtend].CategoryID, [DT: InventoryExtend].Description, [forms]![signpro sign estima parameters]![combo14] HAVING ((([DT: InventoryExtend].CategoryID)=30) AND (([DT: InventoryExtend].Description) Not Like '* ROLL *') AND (([forms]![signpro sign estima parameters]![combo14])=1));"

ANY HELP WOULD BE APPRECIATED ...

Cheers,
QTNM

View 14 Replies View Related

Create Recordset

Jan 17, 2005

What is the easiest way to get the results from a query?
I now create an empty form and set the sql-statement as the recordsource, but this means I can't open two forms simultaniously because they use the same subform.
I know how to creat an ado-recordset, but this would mean the client needs to install extra dll's, my client doesn't have those (I want the program to work on a pc that has access installed and nothing more).

There must be an easier way...

Another problem I have is that when access is closed the MSACCESS proces keeps running, is this a bug, can I have caused this?

With any other access file this is not the case, but they do not have an autoexec.

Please help
Yvonne

View 1 Replies View Related

RunTime Error 75 - HELP !!!

Jul 30, 2005

Hi there,

I'm using the FILECOPY command to copy a specific file on the C drive to a CD.

I have been testing this for ages and it's been working fine. All of a sudden, I am getting a runtime 75 error. WHY???

Thanks in advance,
Paul.

View 1 Replies View Related

Runtime Error 429

Feb 13, 2007

Hi Everyone

Ive created a database using the file system object that creates folders, moves files from one folder to another, etc.

This works perfectly on my home pc, but when i try to install it on the server at work I get the following error message:-

Runtime Error 429

Active X component can't create object

I've had a look on the net and appears that it only happens on certain computers and I wondered if anyone had any quick fixes that they had come across over the years.

Thanks in anticipation

Kindest regards

Tony

View 2 Replies View Related

RunTime Error 0,20,91

Jun 15, 2007

Hi

I am getting Errors: 0,20,91 at the same subroutine
What could be the reason for the error?

Thanks

View 1 Replies View Related

Create Table From A Recordset

Mar 27, 2007

Hi,
I'm trying to create a new table from another existing two in vba. I'm using this code without success... Any help will be gratefully taken.
---------------------
Dim strSQL as string
Dim tablaSuma As DAO.TableDef
Dim rst As DAO.Recordset

strSQL = "SELECT * FROM Necesidades_TRS1, Pedidos WHERE Pedidos.Código=Necesidades_TRS1.Código"
Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
Set tablaSuma = CurrentDb.CreateTableDef("TablaSum")
For Each Campo In rst.Fields
tablaSuma.CreateField(Campo.Name, DB_SINGLE) = Campo
Next
----------------------
Mike

View 8 Replies View Related

Runtime Error 3320

Jun 1, 2005

"Function is not available in expressions in table level validations"


I keep getting this message when trying to update the value of a text box when using the following code

Forms!frmFinanceProposal!Text940 = Me.Text253

Would someone be able to explain what this message means pls!!!

View 1 Replies View Related

Runtime Error 1004

Aug 31, 2005

Good morning

I had yesterday off work and have come back to a nightmare.

The database we use doesnt work the way it should anymore.

There is a switchboard which gives us the option to show a booking form...Worked fine until someone did something to it yesterday.

When I click on the command button to load the form I get an error saying that there was a runtime error 2001 " You canceled the previous operation"

How do I fix this??? I so confused.

I have tried opening the form other ways but it appears to be locked and wont open.


Please if someone could share some light!!!!


TIA

View 4 Replies View Related

RunTime Error 2105

Jun 15, 2007

Hi

I have this error when on:
DoCmd.GoToRecord acDataForm, "PaycheckTable", acNewRec
Whent I trace with the debugger when the ENTER keyy is pressed event.

If I don't use the debugger I don't see any error.
This problem occurs when I check a specific checkbox and trying to go to a new record (Whith the other checkboxes I don't have a problem).

Another symotom:
When I use the next or new record buttons I don't have any problem.

How can I fix the problem?

Thanks

View 1 Replies View Related

Help With Runtime Error 3131

Mar 27, 2008

i am tring to write a find fun and useing the following code but it keep giving me the error 3131

Please help


If Ponumber.Value = "" Then MsgBox "Nothing To Search": Exit Sub


Set db = CurrentDb

Set rstOrder = New ADODB.Recordset
rstOrder.Open "table1", CurrentProject.Connection, adOpenStatic, adLockOptimistic
Set rst = db.OpenRecordset("Select * From " & table1 & " where PoNumber = ") & Trim(Ponumber)

View 5 Replies View Related

What Is Runtime Error 7225?

Sep 7, 2005

As the topic indicates: what is runtime error 7225?
Thanx for your help

View 1 Replies View Related

Runtime Error '5852'

Jun 1, 2006

Hello All,

Using Access 2003 and Word 2003 on a WinXp Workstation with all SPs and updates.

The code that I'm using is MS standard (see below) and has never previously given me any problems albeit using Access 2000 and Word 2000.

I've searched the MS knowledge base and googled the error but nothing I find seems to relevant to this situation.

It falls over on the '.Destination = wdSendToNewDocument' line.


Can someone help?

TIA,

Mo

--------Code----------


DoCmd.Hourglass True

If CreateWordObj() Then
With gobjWord
.Visible = True
.Documents.Open "d:screening emplate.doc"
DoEvents
With gobjWord.ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
.Execute
End With
'.ActiveDocument.PrintPreview
.Visible = True
End With
End If

DoCmd.Hourglass False

View 3 Replies View Related

Runtime Error 94 - Help / Confused

Jul 14, 2006

Hi,

I created a database for someone at work, with the main point of it being for someone to enter a date in one field, and then 13 weeks from that date, it ticks a box, and then 26 weeks from the date inputted, it ticks another box.

Now, all was working fine, but today she came to me and showed me an error that keeps appearing.

What happens is when she creates a new record on the form, if she doesn't input either a date (so the above formula can work), or the persons name in the appropriate field, a Runtime Error 94 appears, which I think says 'Invalid Use of Null', or something along them lines.

I've looked at the coding, and am a bit stuck (bare in mind I don't know a great deal about coding).

From memory, in the coding, the database looks at the date inputted, then adds 13 or 23 weeks to the date, and ticks when it gets to that point. However, if this date isn't inputted, that is when the run time error appears. I have no idea at all why this happens when the name isn't inputted.

If it's any help at all, the bit that is highlighted in yellow in VB, when I click debug, is as follows:

dStart = Me.txtStartDate

Underneath this it has the formula that adds 13 weeks to that date, and then the same but for 26 weeks.

I'm guessing I need to tell it that when there is nothing inputted in the date field, it doesn't have to do the formula. It doesn't like having nothing in the date field.

Apologies if that makes no sense.

If anyone at all can help, it would be much appreciated.

Cheers

Dan

View 8 Replies View Related

Create Recordset From Combo Choice

Jun 2, 2005

I have a table called Contacts and a form with two combo boxes for searching for records either by name or property name. The following code works fine for finding the first record, but I want to be able to show on the form all (and only) those records which match the combo box entry. Currently rowsource for name box is:
************************************************** *
SELECT [Last Name1] FROM Contacts UNION SELECT [Last Name2] FROM Contacts
ORDER BY Contacts.[Last Name1];
************************************************** *
and code is:
************************************************** *
Private Sub Combo214_AfterUpdate()
' Find the record that matches the control for Last Name search
Dim rs As DAO.Recordset

Set rs = Me.Recordset.Clone
rs.FindFirst "[Last Name1]= '" & Me.[Combo214] & "' OR [Last Name2]= '" & Me.[Combo214] & "'"
rs.FindNext "[Last Name1]= '" & Me.[Combo214] & "' OR [Last Name2]= '" & Me.[Combo214] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Combo214.Value = ""
txtFirstName1.SetFocus
End Sub
************************************************** *
Rowsource for property box is:
************************************************** *
SELECT Contacts.PropertyID, Contacts.PropertyName
FROM Contacts
ORDER BY Contacts.PropertyName;
************************************************** *
and code is:
************************************************** *
Private Sub Combo212_AfterUpdate()
' Find the record that matches the control for Property Name search
Dim rs As dao.Recordset

Set rs = Me.Recordset.Clone
rs.FindFirst "[PropertyID] = " & Str(Nz(Me![Combo212], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Combo212.Value = ""
cboPropertyName.SetFocus
End Sub
************************************************** **

Any help is appreciated!

View 7 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

Weird Access Runtime Error

Jun 15, 2006

I have been writing databases for several years now, so I know my way around access pretty good. I have come upon a strange error though. which is confusing me to now end. I wrote a Database on my work machine which has the latest version of MS Access and SP2 for Office. I just tried to send it to another employee for them to test. Now they do not have the full version of MS Access installed on their machine, they only have the runtime version which only runs the Database. The load works fine and the first screen uses ADO to lookup some value and display them in a list box, nothing crazy, everything works fine. Now using this form, when they click a button the info in the list box is used to set the Fields a new Unbound form. And this is where the error happens. The on_load event of the form fails for some reason, and gives a msgbox which says, "Runtime error occured and the App needs to close", but the prog works fine on my machine. I am baffled. The file is a MS Access 2000 format, I tried changing it to MS Access 2002/2003 Format, and when I do that they cannot open the file because it says they do not have thje latest MS Access version. I have no idea what, why the error occurs, any ideas??

View 1 Replies View Related

How To Mondify RunTime Error 2113

Jun 16, 2007

I need to know how to mondify the message text of RunTime Error 2113 when the user type invalid value in the date field?

View 2 Replies View Related

Runtime Error:3734. The Database Has Been Placed....

Dec 10, 2007

Hello all!!

That error keeps on appearing in my application and no way to sort it out...

The error is the following:
Runtime error 3734: the database has been placed in state by user 'Admin' on machine ... that prevents it from being opened or blocked.

I tried to sort it out by doing:

set db= opendatabase(database,0)

but still appearing the message.

could i solve it by checking if there is an actual opened connection before starting a new one? and in case that that there is an opened one, close that.

Don't know what else to try!!

Thanks in advance

View 5 Replies View Related

Runtime Error 3061 Too Few Parameters

Jul 1, 2005

Hello Access friends,
What is wrong with the following code (modified the module from http://members.iinet.net.au/~allenbrowne/AppInventory.html ):
I Keep getting a runtime error 3061 Too few parameters . Expected 1 on the line highlight below.
I have the reference MS DAO 3.6 selected and I am using access 2000 and calling the module from a command button in a form.
Thanks in advance for taking the time to help me out.

Dim db As DAO.Database 'CurrentDb()
Dim rs As DAO.Recordset 'Various recordsets.
Dim strProduct As String 'vProductID as a string.
Dim strAsOf As String 'vAsOfDate as a string.
Dim strSTDateLast As String 'Last Stock Take Date as a string.
Dim strDateClause As String 'Date clause to use in SQL statement.
Dim strSQL As String 'SQL statement.
Dim lngQtyLast As Long 'Quantity at last transaction.
Dim lngQtyAcq As Long 'Quantity acquired since incoming transaction.
Dim lngQtyUsed As Long 'Quantity used since outgoing transaction.

If Not IsNull(vProductID) Then
'Initialize: Validate and convert parameters.
Set db = CurrentDb()
strProduct = vProductID
If IsDate(vAsOfDate) Then
strAsOf = "#" & Format$(vAsOfDate, "mm/dd/yyyy") & "#"
End If

'Get the last transaction date and quantity for this product.
If Len(strAsOf) > 0 Then
strDateClause = " AND ([TransacDate] <= " & strAsOf & ")"
End If
strSQL = "SELECT TOP 1 [TransacDate], [Quantity] FROM [Transactions] " & _
"WHERE ((ProductID = " & strProduct & ")" & strDateClause & _
") ORDER BY TransacDate DESC;"

Set rs = db.OpenRecordset(strSQL)
With rs
If .RecordCount > 0 Then
strSTDateLast = "#" & Format$(![TransacDate], "mm/dd/yyyy") & "#"
lngQtyLast = Nz(!Quantity, 0)
End If
End With
rs.Close

'Build the Date clause
If Len(strSTDateLast) > 0 Then
If Len(strAsOf) > 0 Then
strDateClause = " Between " & strSTDateLast & " And " & strAsOf
Else
strDateClause = " >= " & strSTDateLast
End If
Else
If Len(strAsOf) > 0 Then
strDateClause = " <= " & strAsOf
Else
strDateClause = vbNullString
End If
End If

'Get the quantity acquired since then.
strSQL = "SELECT Sum([Transactions].[Quantity]) AS QuantityAcq " & _
"FROM [Transactions]" & _
"WHERE (([Transactions].[ProductID] = " & strProduct & ") AND ([Transactions].[TransacType] = 'Incoming')"
If Len(strDateClause) = 0 Then
strSQL = strSQL & ");"
Else
strSQL = strSQL & " AND ([Transactions].[TransacDate] " & strDateClause & "));"
End If

Set rs = db.OpenRecordset(strSQL)
If rs.RecordCount > 0 Then
lngQtyAcq = Nz(rs!QuantityAcq, 0)
End If
rs.Close

'Get the quantity used since then.
strSQL = "SELECT Sum([Transactions].[Quantity]) AS QuantityUsed " & _
"FROM [Transactions]" & _
"WHERE (([Transactions].[ProductID] = " & strProduct & ") AND ([Transactions].[TransacType] = 'Outgoing')"
If Len(strDateClause) = 0 Then
strSQL = strSQL & ");"
Else
strSQL = strSQL & " AND ([Transactions].[TransacDate] " & strDateClause & "));"
End If

Set rs = db.OpenRecordset(strSQL)
If rs.RecordCount > 0 Then
lngQtyUsed = Nz(rs!QuantityUsed, 0)
End If
rs.Close

'Assign the return value
OnHand = lngQtyLast + lngQtyAcq - lngQtyUsed
End If

Set rs = Nothing
Set db = Nothing
Exit Function
End Function

View 3 Replies View Related

Runtime Error Err Number Is -2147467259

Aug 12, 2006

Hai
I am arif.I am a vb programmer.I try to open the recordset but one error coming that is methot 'open' of 'object_recordset' failed.


Private sub cmdcheck_click()
dim rscom as adodb.recordset
s1="select * from class_subj where class='"& trim(lstclass) & "' and section=
'"& trim(lstsection) & "'"
set rscom=new adodb.recordset
rscom.cursorlocation=aduseclient
rscom.open s1,con,adopendynamic,adlockoptimistic
rscom.close
set rscom= Nothing
End sub

Please clear this problem

regards
ARIF

View 2 Replies View Related

Help !! Runtime Error Trying To Retrieve Record

May 4, 2005

I have an 'add new order' form which opens with all the fields blank and focus set to a combo box. The first thing the user must do is select a contract name or number from an unbound combo box. I then want the form to update and show all the relevant information in the form fields.

In the row source of the combo box I select all 3 fields from the same table (Project_Info). Only the contract number is visible all others are set to 0cm width in combo box properties.

In the afterupdate event I have the following code to set the field to the values from the select query

My code looks like this:
[code]
Private Sub ProjectContractNum_AfterUpdate()
Dim sOrder_idSource As String
Dim rs As Object
ProjectName = ProjectContractNum.Column(1)
proj_status = ProjectContractNum.Column(2)

End Sub
[end code]

My SQL in rowSource looks like this:
SELECT Project_Info.proj_name, Project_Info.proj_contract_no, Project_Info.proj_status FROM Project_Info;

Access tells me that I don't have a join key in my record set.
message reads as follows:-
Run-time error '2147352567 (80020009)':
Cannot add record(s);Join key of table Project_Info' not in record set.

Debug highlights this line:
proj_status = ProjectContractNum.Column(2)

'proj_status' is the name of the text box and the control source.


If I just use just the first 2 fields (project number and project name) these two work!!

What am I doing wrong?

Thx, Kev.

View 3 Replies View Related







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