I've created a button in formA which updates the table in question, but i'd like to have an option to update and open the same record in form2
(different datafields are being entered so i don't think the - DoCmd.openForm "form2", , , "[field]=" & Me.[field]
approach will work).
Is there anyway i can use the .bookmark property to open the new form?
The primary key is autogenerated on update, but as they're not a part of the input(1) or update(2) forms I'd like to avoid using it if possible
24 5056 FishVal 2,653
Recognized Expert Specialist
I've created a button in formA which updates the table in question, but i'd like to have an option to update and open the same record in form2
(different datafields are being entered so i don't think the - DoCmd.openForm "form2", , , "[field]=" & Me.[field]
approach will work).
Is there anyway i can use the .bookmark property to open the new form?
The primary key is autogenerated on update, but as they're not a part of the input(1) or update(2) forms I'd like to avoid using it if possible
Hi!
First of all there is no any reason why DoCmd.OpenForm will not work here.
You can use any field of Form2 Recordsource in DoCmd.OpenForm WhereCondition argument no matter it is bound or not to any control (certainly PK is preferrable).
If you have any special reason not to show the corresponding field on Form1, you can either hide the control bound to the corresponding field or retrieve it's value from Form1 Recordset.
I don't see any problem at all.
Hi!
First of all there is no any reason why DoCmd.OpenForm will not work here.
You can use any field of Form2 Recordsource in DoCmd.OpenForm WhereCondition argument no matter it is bound or not to any control (certainly PK is preferrable).
If you have any special reason not to show the corresponding field on Form1, you can either hide the control bound to the corresponding field or retrieve it's value from Form1 Recordset.
I don't see any problem at all.
When you say retrieve value from recordset, is that to say i can reference a value not explicitly included in form1, provided its a field on the table? And if so can I reference a key which is autofilled on completion of Form1?
FishVal 2,653
Recognized Expert Specialist
When you say retrieve value from recordset, is that to say i can reference a value not explicitly included in form1, provided its a field on the table? And if so can I reference a key which is autofilled on completion of Form1?
Sure.
Something like this (assumed this is in Form1 module), where keyID is the name of PK table field
Sure.
Something like this (assumed this is in Form1 module), where keyID is the name of PK table field
Thats the most helpful thing i've gotten yet! You rock. - Now why does it insist on only applying changes to the First record?
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stLinkCriteria = "Me.LastModified!key = & Forms![Input Form].txtkey"
-
stDocName = "Update"
-
DoCmd.openForm stDocName, , , stLinkCriteria
-
FishVal 2,653
Recognized Expert Specialist
Thats the most helpful thing i've gotten yet! You rock. - Now why does it insist on only applying changes to the First record?
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stLinkCriteria = "Me.LastModified!key = & Forms![Input Form].txtkey"
-
stDocName = "Update"
-
DoCmd.openForm stDocName, , , stLinkCriteria
-
???
What is this code supposed to do?
I mean stLinkCriteria which is completely senseless. It should be a WHERE clause for Form_Update Recordsource.
For example
assumed
- the code opening Form_Update is in Form_Input module
- the name of recordsource table/query field you want to filter by is [Field]
- the [Field] is not bound to any control in Form_Input -
stLinkCriteria = "[Field] = " & Me.Recordset![Field]
-
or -
stLinkCriteria = "[Field] = " & Me![Field]
-
if anyway it is bound to Form_Input field named Field.
???
What is this code supposed to do?
I mean stLinkCriteria which is completely senseless. It should be a WHERE clause for Form_Update Recordsource.
For example
assumed
- the code opening Form_Update is in Form_Input module
- the name of recordsource table/query field you want to filter by is [Field]
- the [Field] is not bound to any control in Form_Input -
stLinkCriteria = "[Field] = " & Me.Recordset![Field]
-
or -
stLinkCriteria = "[Field] = " & Me![Field]
-
if anyway it is bound to Form_Input field named Field.
Well while i am quite sure its rather convoluted at this point, its an attempt at opening a newly added record in a new form. it started out as you have above - but checking that again im getting a .(dot) or !operator or invalid parenthesis error...
FishVal 2,653
Recognized Expert Specialist
Well while i am quite sure its rather convoluted at this point, its an attempt at opening a newly added record in a new form. it started out as you have above - but checking that again im getting a .(dot) or !operator or invalid parenthesis error...
Post the whole sub which opens form "Update", as it looks so far, just to make sure we are mentioning the same.
BTW be aware that while a record is not saved (pencil mark on the record selector) you can't open it in another form. To save the record use -
DoCmd.RunCommand acCmdSaveRecord
-
anywhere before DoCmd.OpenForm command.
heres the sub ATM. im still getting the same error. I added the save command, and have changed my PK from an Autonumber to number, and its control source to =DMAX("key",[tbl Modifications]) + 1.
not that it produced any results per se. -
Private Sub Command85_Click()
-
On Error GoTo Err_Command85_Click
-
With CurrentDb.OpenRecordset("tbl Modifications", dbOpenTable)
-
.AddNew
-
!Program = Me.txtProgram '\
-
!Name = Me.cboName '|
-
!ObjectClass = Me.cboObjectClass
-
!ParentProgram = Me.txtParentProgram
-
!Fund = Me.txtfund
-
!ReportingEntity = Me.txtReportingEntity
-
!PurchaseOrder = Me.txtPurchaseOrder
-
!Comments = Me.txtComments
-
!AppropriationYear = Me.cboAppropriationYear
-
!Site = Me.txtsite
-
!DOR = Me.txtDOR
-
!FiscalYear = Me.cboFiscalYear '|
-
!Description = Me.txtdescription '|
-
!Budget = Me.txtCharge '|
-
!UpdateDate = Date
-
!SSD = Me.txtSSD
-
!CertifiedDocument = Me.objRequest
-
!BCD = Me.txtBCD
-
!FCD = Me.txtFCD
-
!Vendor = Me.txtVendor
-
!key = Me.txtkey
-
.Update
-
.Bookmark = .LastModified
-
End With
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stLinkCriteria = "[txtkey]= " & Me![txtkey]
-
stDocName = "Update"
-
DoCmd.RunCommand acCmdSaveRecord
-
DoCmd.openForm stDocName, , , stLinkCriteria
-
-
-
Exit_Command85_Click:
-
Exit Sub
-
-
Err_Command85_Click:
-
MsgBox Err.Description
-
Resume Exit_Command85_Click
-
-
End Sub
-
edit: I also tried Me.Recordset![txtkey] which had the same result
another edit: stepping through the code, it goes to error on !key = Me....
FishVal 2,653
Recognized Expert Specialist
heres the sub ATM. im still getting the same error. I added the save command, and have changed my PK from an Autonumber to number, and its control source to =DMAX("key",[tbl Modifications]) + 1.
not that it produced any results per se. -
Private Sub Command85_Click()
-
On Error GoTo Err_Command85_Click
-
With CurrentDb.OpenRecordset("tbl Modifications", dbOpenTable)
-
.AddNew
-
!Program = Me.txtProgram '\
-
!Name = Me.cboName '|
-
!ObjectClass = Me.cboObjectClass
-
!ParentProgram = Me.txtParentProgram
-
!Fund = Me.txtfund
-
!ReportingEntity = Me.txtReportingEntity
-
!PurchaseOrder = Me.txtPurchaseOrder
-
!Comments = Me.txtComments
-
!AppropriationYear = Me.cboAppropriationYear
-
!Site = Me.txtsite
-
!DOR = Me.txtDOR
-
!FiscalYear = Me.cboFiscalYear '|
-
!Description = Me.txtdescription '|
-
!Budget = Me.txtCharge '|
-
!UpdateDate = Date
-
!SSD = Me.txtSSD
-
!CertifiedDocument = Me.objRequest
-
!BCD = Me.txtBCD
-
!FCD = Me.txtFCD
-
!Vendor = Me.txtVendor
-
!key = Me.txtkey
-
.Update
-
.Bookmark = .LastModified
-
End With
-
Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stLinkCriteria = "[txtkey]= " & Me![txtkey]
-
stDocName = "Update"
-
DoCmd.RunCommand acCmdSaveRecord
-
DoCmd.openForm stDocName, , , stLinkCriteria
-
-
-
Exit_Command85_Click:
-
Exit Sub
-
-
Err_Command85_Click:
-
MsgBox Err.Description
-
Resume Exit_Command85_Click
-
-
End Sub
-
edit: I also tried Me.Recordset![txtkey] which had the same result
another edit: stepping through the code, it goes to error on !key = Me....
Ok. Its much more cleare now where the legs are growing from.
The problem is so far in record update. The syntax seems to be Ok. Just a silly question concerning this: is the form bound to [tbl Modifications]?
The next one: is form "Update" bound to [tbl Modifications]?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Sue Adams |
last post by:
I actually have two issues/questions:
I have an autonumber field in an access db table that I grab and later use to update a record in another table withing the same db.
The code I use to get it from the db table is:
''Retrieve the Registration Identification Number
strRegisterID = Rs("Register_ID")
Prior to testing my code and actually...
|
by: Dom Boyce |
last post by:
Hi
First up, I am using MS Access 2002.
I have a database which records analyst rating changes for a list of
companies on a daily basis. Unfortunately, the database has been set
up (by my predecessor, I hasten to add) so that each day it creates a
copy of the record for each company, changes the date to today's date,
and prompts the user...
|
by: Jonathan Upright |
last post by:
Greetings to anyone who can help:
I'm using WebMatrix to make ASP.NET pages, and I chose the "Editable
DataGrid" at the project selector screen. As you may know, it defaults
to the Microsoft SQL database "pubs". I've followed the instructions in
the comments and also changed everything pertaining to SQL over to
OLEDB. (i.e. Changed...
|
by: mursyidatun ismail |
last post by:
Dear all,
database use: Ms Access.
platform: .Net
i'm trying to update a record/records in a table called t_doctors by
clicking da edit link provided in the database.
when i ran through da browsers and click update it gave me this error:
Specified argument was out of the range of valid values. Parameter name:
|
by: Mark Reed |
last post by:
Hi All,
I'm having a problem with the following code. I've read quite a lot of
old posts regarding the issue but none seem to affer a solution.
The scenario is. I have a bound form which contains a couple of memo fields.
I need to keep some sort of log as to when each update of the memo field
occurs so I have locked bot the memo fields on...
| |
by: Stephen Plotnick |
last post by:
I'm very new to VB.NET 2003
Here is what I have accomplished:
MainSelectForm - Selects an item
In a public class I pass a DataViewRow to
ItemInformation1 Form
ItemInformation2 Form
|
by: mtgrizzly52 |
last post by:
Hi all,
I've looked for an answer for this in lots of books, online in several discussion groups and have not found the answer which I feel may be very simple.
What I want to do is have a switchboard with several active buttons on it for entering new data, updating data, reports etc. The new data and report stuff is easy, but the update...
|
by: Access Programming only with macros, no code |
last post by:
ERROR MESSAGE:
Could not update; currently locked by another session on this
machine.
BACKGROUND
I have the following objects:
Table1 - HO (which has about 51,000+ records)
Table2 - Contact (which has 68,000+ records)
|
by: teenagelcruise |
last post by:
hi,
i have a problem with my code which is i cannot update and addnew data into the database but i can delete the data.plz give me an idea.this is my code that i wrote.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Order Record</title>
<meta name="Microsoft Border" content="tlb, default">...
|
by: sirdavethebrave |
last post by:
Hi guys -
I have written a form, and a stored procedure to update the said form.
It really is as simple as that. A user can go into the form, update some fields and hit the update button to update the information which is stored in a SQL database.
In testing we noticed that the form was updating correctly but the update mechanism was also...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |