Hi,
I have just been on an access course and was given the following code: - Dim rs As DAO.Recordset
-
Set rs = Forms!frmFilm.Form.RecordsetClone
-
-
Call rs.FindFirst("FilmID =" & Me.lstFilm.Value)
-
Forms!frmFilm.Recordset.Bookmark = rs.Bookmark
-
Call DoCmd.Close(acForm, "frmFindFilm")
-
-
I have a form called frmFilm and a form called frmFindFilm, the above code is in the frmFindFIlm module. I'm using access 2002 (and have also tried it on access 2003) and the following error occurs:
-
-
Run-time error '2450':
-
-
Film Library can't find the form 'frmFilm' referenced in a macro expression or visual basic code. When I click debug the following line is highlighted:
-
-
Set rs = Forms!frmFilm.RecordsetClone
Can anyone help? Thanks
Gemma
3 5694
Hi,
I have just been on an access course and was given the following code:
Dim rs As DAO.Recordset
Set rs = Forms!frmFilm.Form.RecordsetClone
Call rs.FindFirst("FilmID =" & Me.lstFilm.Value)
Forms!frmFilm.Recordset.Bookmark = rs.Bookmark
Call DoCmd.Close(acForm, "frmFindFilm")
I have a form called frmFilm and a form called frmFindFilm, the above code is in the frmFindFIlm module. I'm using access 2002 (and have also tried it on access 2003) and the following error occurs:
Run-time error '2450':
Film Library can't find the form 'frmFilm' referenced in a macro expression or visual basic code. When I click debug the following line is highlighted:
Set rs = Forms!frmFilm.RecordsetClone
Can anyone help? Thanks
Gemma
Gemmal,
Ok, the reason that the reference line that you're speaking about doesn't work, you're assuming the form that it's trying to reference is Open. The reason it fails is because there isn't an active reference to the recordset. You'll need to create the recordset within the code block that you're speaking of in order to make use of it.
for example: -
Dim db as DAO.Database
-
dim rs as DAO.Recordset
-
-
'Set rs = db.OpenRecordset("The Name of the table that you're wanting the information from",dbOpenDynaset)
-
-
'Example
-
-
Set rs = db.OpenRecordSet("SELECT * FROM [Film Table] WHERE FilmID=" & me.lstFilm.value, dbOpenDynaset)
-
-
'Then you can simply display that recordset in a listbox or set the Recordset to the active form, as long as the active form is of the same structure as the table it is coming from?
-
-
'otherwise, I would simply display that in a listbox control
-
-
If you need help as to how to bind that to another control on a form, or how to display the results in a listbox control, let me know, I can send you code examples.
Hope that helps,
Joe P.
Ji Joe,
Do you mind sending the code examples as i need this to my application. I have got a recordset with 22 columns and rows may varry, I need this data to be displayed on grid view control or similar.
I have used this but its failed
Gridview4.DataSource = MyRSet.
Comes up with Run time error 438.
Also i need a functionality to edit one of the colum and update in database accordingly.
Much appreciated if you can send me the code
Ji Joe,
Do you mind sending the code examples as i need this to my application. I have got a recordset with 22 columns and rows may varry, I need this data to be displayed on grid view control or similar.
I have used this but its failed
Gridview4.DataSource = MyRSet.
Comes up with Run time error 438.
Also i need a functionality to edit one of the colum and update in database accordingly.
Much appreciated if you can send me the code
Ok, take what I've already sent you to connect to the data and if you're wanting to bind that to your List control Gridview4 then here's what you need to do.
In the same routine and the following line of code: -
-
me.gridview4.rowsource = MyRSet.Name
-
-
Please make sure that the number of columns and the columnwidths are set to display the data the way that you want it to.
If you have more questions, let me know.
Joe P.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Seth Spearman |
last post by:
Hey guys,
I have the following code:
'******************************************************
If Not Me.NewRecord Then
Dim rs As DAO.Recordset
Dim strBookmark As String
Set rs =...
|
by: Anthony Kroes |
last post by:
I have a subform on a form and they are not linked. On the main form is
a text box where the user types in a number. When that number changes,
I have some code to make the corresponding text...
|
by: Ian Bailey |
last post by:
I have developed a routine that opens a number of forms with each form
being positioned on a particular record. I am using the
Recordsetclone to find the record and then setting the form bookmark...
|
by: GGerard |
last post by:
Hello
I am trying to refer in code to the RecordsetClone of a subform datasheet
but I'm getting syntax errors.
This is what I am writing:
Set MyDB = DBEngine.Workspaces(0).Databases(0)...
|
by: Br |
last post by:
First issue:
When using ADPs you no longer have the ability to issue a me.refresh to
save the current record on a form (the me.refresh does a requery in an
ADP).
We usually do this before...
|
by: G Gerard |
last post by:
Hello
Can I write an SQL statement in code using a RecordSetClone of an open form?
something like:
MySQL = "UPDATE Me!Child0.Form.RecordSetClone SET
Me!Child0.Form.RecordSetClone.MyField =...
|
by: Orchid |
last post by:
Hello all,
I have a Combo Box on a form with selection of a firm list. When the
users select a firm from the Combo Box and if the firm has branch(es),
a list of branch(es) of the firm opens in a...
|
by: d.francis |
last post by:
I have converted an Access 97 database to Access 2003
The following code now fails and returns Run-time error '3420'
Dim rst as DAO.recordset
Set rst = Forms!frm1!frm2.Form.RecordsetClone
I...
|
by: Certys |
last post by:
Hello,
I have a form where I only allow new records to be added. I enable
this by setting the form property "Data Entry" to Yes.
I want to access other records in the same table- to autofill...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |