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
Jun 29 '07
24 5063 FishVal 2,653
Recognized Expert Specialist
Ok so form two was indeed unbound, a problem which has been addressed.
this didnt work: - Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "Update"
-
-
stLinkCriteria = "[txtkey]=" & Me!txtkey
-
DoCmd.openForm stDocName, , , stLinkCriteria
which leads to "syntax error (missing operator) in query expression '[txtkey]='
so i tried this approach: - DoCmd.openForm "Update"
-
-
Forms!Update!txtkey.SetFocus
-
-
DoCmd.FindRecord Forms![Input Form]!txtkey
which gives me "An expression you entered is the wrong data type for one of the arguements" (goes to error on last line)
any ideas?
Change the first code to this. WhereCondition argument in DoCmd.OpenForm has to have name of table field to the left of '=' not name of form control. - Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "Update"
-
-
stLinkCriteria = "key=" & Me!txtkey
-
DoCmd.openForm stDocName, , , stLinkCriteria
this: - Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "Update"
-
-
stLinkCriteria = "![keyID]=" & Me!txtkey
-
DoCmd.openForm stDocName, , , stLinkCriteria
gives me a 'syntax error'
this: - DoCmd.openForm "Update", acNormal, , "!keyID='" & Me![txtkey] & "'", acFormEdit, acWindowNormal
prompts me for a parameter value for keyID
this (stolen from another of your posts): - Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "Update"
-
stLinkCriteria = "[keyID]=" & "'" & Me![txtkey] & "'"
-
-
With DoCmd
-
.RunCommand acCmdSaveRecord
-
.openForm stDocName, , , stLinkCriteria
-
End With
-
-
Forms![Update]![txtkey].DefaultValue = Me![txtkey]
says command or action saverecord is unavailable.
when put in this: -
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
-
!Amendment = Me.txtAmendment
-
-
.Update
-
.Bookmark = .LastModified
-
-
End With
-
-
Exit_Command85_Click:
-
Exit Sub
-
-
Err_Command85_Click:
-
MsgBox Err.Description
-
Resume Exit_Command85_Click
-
-
End Sub
FishVal 2,653
Recognized Expert Specialist
this: - Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "Update"
-
-
stLinkCriteria = "![keyID]=" & Me!txtkey
-
DoCmd.openForm stDocName, , , stLinkCriteria
gives me a 'syntax error'
this: - DoCmd.openForm "Update", acNormal, , "!keyID='" & Me![txtkey] & "'", acFormEdit, acWindowNormal
prompts me for a parameter value for keyID
this (stolen from another of your posts): - Dim stDocName As String
-
Dim stLinkCriteria As String
-
-
stDocName = "Update"
-
stLinkCriteria = "[keyID]=" & "'" & Me![txtkey] & "'"
-
-
With DoCmd
-
.RunCommand acCmdSaveRecord
-
.openForm stDocName, , , stLinkCriteria
-
End With
-
-
Forms![Update]![txtkey].DefaultValue = Me![txtkey]
says command or action saverecord is unavailable.
when put in this: -
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
-
!Amendment = Me.txtAmendment
-
-
.Update
-
.Bookmark = .LastModified
-
-
End With
-
-
Exit_Command85_Click:
-
Exit Sub
-
-
Err_Command85_Click:
-
MsgBox Err.Description
-
Resume Exit_Command85_Click
-
-
End Sub
Post [tbl Modifications] metadata. Example given below.
Here is an example of how to post table MetaData : Table Name=tblStudent - Field; Type; IndexInfo
-
StudentID; AutoNumber; PK
-
Family; String; FK
-
Name; String
-
University; String; FK
-
Mark; Numeric
-
LastAttendance; Date/Time
I figured much of my problems out, partially a bound form thing, partially through a different approach.
Form1 opens an existing blank record, which it edits, "saves", and opens in a new form. It then closes and generates a new blank for when it opens next.
heres the problem: Values inputed on Form1 fail to save, automatically or even when instructed. my code follows...
from the pulldown menu: - Sub openForm()
-
DoCmd.openForm "Input Form", acNormal, , "[EntryStatus] = 0", acFormEdit, acWindowNormal
-
End Subon
click event: - With DoCmd
-
-
.RunCommand acCmdSaveRecord
-
-
.RunSQL "UPDATE [tbl Modifications] SET [EntryStatus]=(1) WHERE [keyID]= [txtkey]"
-
-
.openForm "Update", acNormal, , "[keyID]=" & Me!txtkey, acFormEdit, acWindowNormal
-
-
.Close acForm, Me.Name
-
-
End With
onclose: - Private Sub Form_Close()
-
-
-
With CurrentDb.OpenRecordset("tbl Modifications", dbOpenTable)
-
.AddNew
-
!EntryStatus = 0
-
.Update
-
End With
-
-
End Sub
got this one. my controls were still unbound. oops.
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 updating the db, I''m trying to write it to the page to make sure their isn''t a loop or massive...
|
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 for any changes of ratings on that day. The
resulting data table grows by approx 600 records per...
|
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 SqlDbType. to OleDbType.) I also changed the
datafield names and variable names accordingly. The page...
|
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 the main form. To edit them,
the user double clicks the ememo field which then opens an unbound...
| |
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 button has me baffled.
What I want to have happen is when the update button is clicked, a parameter...
|
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">
</head>
|
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 updating the first record of the table in the sql database every time. No error messages are on...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |