473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Define Current Subform Record in VBA Code

Im trying to sort out all subform records except for the new record
created via a cmd on the main form.
The command creates the new record, autofills some fields, then the PK
value is autoassigned. I want the previous records listed to be
filtered out. Although thats what I cant get by. The filter wont work
no matter how I put it in. This is how I have it currently.

Here's the code;

Private Sub Create_Job_Click()
Me.Field_Form_Sub_New.Visible = True
Me.Field_Form_Sub_New.Form.AllowAdditions = True
Me.Field_Form_Sub_New.SetFocus
DoCmd.GoToRecord , , acNewRec

Field_Form_Sub_New!Township = Forms!Jobs_Active!TWP
Field_Form_Sub_New!Property = Forms!Jobs_Active!Property
Field_Form_Sub_New!PropertyCode = Forms!Jobs_Active![Property
Code]
Field_Form_Sub_New!SeasonalAccess = Forms!Jobs_Active![Seasonal
Access]
Field_Form_Sub_New![Job Request] = Forms!Jobs_Active![Current
Request]
DoCmd.ApplyFilter , Me.Form.CurrentRecord
End Sub

Ive been trying to apply the filter after the fields are autofilled
because as far as i can tell the PK Value (Autonumber) is not assigned
until the record contains data.
Can I find out what the assigned Autonumber in the code, then filter
on its actual value?
Any help would be greatly appreciated.

Apr 5 '07 #1
0 1851

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lphuong | last post by:
Access 2000 I have a fldCreateDate on frmCustomer(mainform)and also a fldCreateDate on frmCustomerVisit(subform). They are one to many relationship. On the main form, frmCustomer, I have a...
1
by: xmp333 | last post by:
Hi, I have a form that is designed as a data sheet view. Attached to this is a subform with some VB code. When the user clicks on a row, the subform should pop up and run the VB code which...
3
by: Maria | last post by:
Is there another way to delete the current record in a subform from the main form, another subform or a sub-subform other than setting focus on a field in the subform and using run command...
2
by: Melissa | last post by:
I have a single (not continuous) form with an Undo button for entering finished projects. On the form is also a subform that lists all finished projects for reference. When I enter the...
1
by: phaddock4 | last post by:
Being fairly inexperienced at Access 2000, i've been reading many posts here for the last several days, and testing myself to find the best approach to do the following in A2K: SET UP: I have...
1
by: Randy | last post by:
I have tried the code to attach a button to a form and use the help information on coding, but I can't seem to get it to work. I have a main form called MAIN CLIENT INFO2 There is a subform...
1
by: matthewemiclea | last post by:
I have a subform, where in the "on current" event, I display code that is supposed to recognize which record I am pointing to, and then display more specific info in another subform based on that...
5
by: christianlott1 | last post by:
I admit my form is pretty complex and may need a total overhaul - I have two subforms synchronized on a form through an unbound text box. When I enter a new record in the second subform it used...
8
by: anansi | last post by:
Hi I have a form called 'shiftviewer' and it contains a subform called 'all shifts for current month subform'. the subform is in datasheet view (access 2007) and the main form is a column...
0
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,...
0
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$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.