I have a subform of all the customers for the day (limited info). I want to open the specific record on the parent form by clicking an action button, on a specific record, on the subform. I have the following Event Procedure for the action button. When I run the procedure, I get a Run Time Error (3021), No Current Record. What am I doing wrong?
________________ - Dim rs As Object
-
Dim strLinkValue As String
-
-
strLinkValue = Me![CustID].Value 'Name of Link Field On Subform
-
Set rs = Forms!frmNextCustomerContractors.Recordset.Clone 'Name of the Main Form
-
rs.FindFirst "[CustID] = '" & strLinkValue & "'" 'Name of Link Field on main form
-
Forms!frmNextCustomerContractors.Bookmark = rs.Bookmark 'Main Form
6 1804 NeoPa 32,556
Expert Mod 16PB
Your first, and probably main, problem is referring to .Recordset.Clone instead of .RecordsetClone .
I changed .Recordset.Clone to .RecordsetClone
I'm receiving the same error (No Current Record) on line 7.
Any help would be appreciated.
An easier, and more direct approach to this may be simply to filter the parent form by your Search Criteria: - With Me.Parent.Form
-
.Filter = "[CustID] = '" & strLinkValue & "'"
-
.FilterOn = True
-
End With
However, something tells me that your solution is not going to be so straightforward as this (but this is just a hunch).
At this point, both NeoPa and I are both stabbing int he dark, because we don't know how your tables are structured, nor do we know how your Main Form and Sub-Forms are related (if at all).
Without more clear information, we can't really troubleshoot this toward a more accurate solution.
NeoPa 32,556
Expert Mod 16PB
As Twinny says, we're working a little in the dark here. Not that your question is a poor one, just that it's often difficult to know what information is required when you aren't sure of what's wrong. Let's see what we can determine at this point anyway.
First off - I too would recommend the approach Twinny suggests. Too many people overlook this, more simple, approach simply because it doesn't occur to them.
That said, we always like to answer the question put even in situations such as these where there's a much better approach available. In this case I believe you may be trying to use Bookmark s from two quite different Recordset s in your code and that won't work. It can be used between a Form's Recordset and the same Form's RecordsetClone properties, but a Bookmark is a complicated item and depends heavily on the Recordset it's from. Trying to transport that across to a different Recordset simply isn't supported.
I hope that resolves all your issues but please let us know. We're both happy to help further (I know Twinny well enough by now to be confident to say that.) if we can.
I'm getting closer. The following code works but only if the CustID field, on the parent form is visible. I don't want it visible. Any help is appreciated. - Dim strLinkValue As String
-
-
strLinkValue = Me![CustID].Value 'Name of Link Field On Subform
-
Forms.Item("frmNextCustomerContractors").RecordSource = "qryNextCustomerContractorsToday"
-
MsgBox strLinkValue
-
DoCmd.GoToControl "CustID"
-
DoCmd.FindRecord strLinkValue, , True, , True
NeoPa 32,556
Expert Mod 16PB
Well, it seems that you've ignored the advice about using a filter instead of going to the record, and haven't explained why. That's disappointing. If we're to work together then we need to understand what you're doing and why. Too many guesses along the road is not good for any of us.
That said, we could proceed anyway except for the fact we have no indication of what isn't working. You simply say it isn't. I'd guess that line #6 would cause an issue. You can't set the focus to a Control that isn't visible. That wouldn't make sense. It's hard even to guess why you have that in there. Sometimes we can guess based on experience and simple logic, but in this case there appears to be none of the latter so I'm lost.
Perhaps if you could explain your thinking more fully we would be in a better place to understand where you're coming from and why you do things the way you do. As a bare minimum, if you have something that isn't working, you should explain exactly what happens and where in the code it happens.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Andante.in.Blue |
last post by:
Hi everyone! In Access 97, I have a parent form and a subform that
are both based on the same query. The main form is continuous and
serves up a summary for each record. The subform provides...
|
by: Lyn |
last post by:
Hi,
I am working on a genealogy form. The only table (so far) lists everybody
in the family, one record per person. Each record has an autonum ID.
The parent form (frmMainForm) displays the...
|
by: tdmailbox |
last post by:
I have a form with a child form. In the child form there is a list of
names that can grow quite large. On the parent form I want to display
the first name from the child form. I set up a test...
|
by: Thelma Lubkin |
last post by:
My form/subform combination that allows user to display 'ColorSet'
records, move to other records via a selector, to add,delete, and
edit them, and to manage the related 'Color' records from the...
|
by: dbuchanan |
last post by:
Hello,
I want to open a child form based on the record selected in a
dataGridView of the parent form.
I want the child form to open with a populated child table based on the
selected parent...
|
by: bitsnbytes64 |
last post by:
Hi,
I have a form which contains a subform. Both are were creetd using the form wizard and are bound by the column IXO_NR (on two different tables), which is the control source for a textbox on...
|
by: dscarbor |
last post by:
I have a simple form with 4 fields, and a subform that retrieves records that are potential matches based on a query.
The user will use the ID from the subform record and enter it into one of the...
|
by: troy_lee |
last post by:
I have a table (Table A). It has one field, a PK. It is in a 1:M with
another table (Table B). I am having trouble with a form/subform setup
to view the 1:M records.
On the parent form, there is...
|
by: solom190 |
last post by:
Okay this is the situation I have two forms and they have a 1:M relationship. I don't have enough space screen-wise to do a traditional "drag form to form" to create a subform so what I did was...
|
by: jase7678 |
last post by:
Hello,
I'm confused with my latest issue in Access 2013 because at one point in time it's worked exactly as intended. I'm putting together a pretty large database application so finish one piece...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
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: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
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...
| |