Accessing current record

What is the syntax for referring to the underlying record that a form
is currently displaying?

In other words, I would like to make a change to an attribute of a
record that is being displayed when a user clicks a button. I believe
the best way to do this is through modifying the VB code that
underlies the onClick event, but I can't figure out how to reference
the record that is being displayed in the current (or active) record.

In this case, we're dealing with a boolean value (I realize that I
could simply have the checkbox in the form, have the user check or
uncheck the box, then submit the form. In this application, it is more
intuitive to have the user click a button that will simultaneously
commit the transaction and update the attribute). The user uses the
form to search or navigate to a record of interest. When they click
the "Discharge Patient" button, the boolean attribute "is_admitted"
changes to false and the form exits.

How do I reference or modify this data? Seems like I could generate a
SQL statement and submit it (in this case, I would still have to know
how to reference the current record within the SQL statement, I'm also
not sure how to submit a SQL statement within VBA). But it also seems
logical that there might be a way to modify the record within the form
itself (i.e. set currentRecord.is_admitted to FALSE) using just VBA.

Thanks,
--b

0
cbnewman
5/2/2007 5:55:52 PM
access 16762 articles. 2 followers. Follow

4 Replies
1349 Views

Similar Articles

[PageSpeed] 39

Add a checkbox for the Boolean field to the form, but set it's Visible 
property to No. Then in the onclick event, use the line Me.MyCheckbox = 
false

-- 
hth,
SusanV

<cbnewman@gmail.com> wrote in message 
news:1178128552.406004.222740@q75g2000hsh.googlegroups.com...
> What is the syntax for referring to the underlying record that a form
> is currently displaying?
>
> In other words, I would like to make a change to an attribute of a
> record that is being displayed when a user clicks a button. I believe
> the best way to do this is through modifying the VB code that
> underlies the onClick event, but I can't figure out how to reference
> the record that is being displayed in the current (or active) record.
>
> In this case, we're dealing with a boolean value (I realize that I
> could simply have the checkbox in the form, have the user check or
> uncheck the box, then submit the form. In this application, it is more
> intuitive to have the user click a button that will simultaneously
> commit the transaction and update the attribute). The user uses the
> form to search or navigate to a record of interest. When they click
> the "Discharge Patient" button, the boolean attribute "is_admitted"
> changes to false and the form exits.
>
> How do I reference or modify this data? Seems like I could generate a
> SQL statement and submit it (in this case, I would still have to know
> how to reference the current record within the SQL statement, I'm also
> not sure how to submit a SQL statement within VBA). But it also seems
> logical that there might be a way to modify the record within the form
> itself (i.e. set currentRecord.is_admitted to FALSE) using just VBA.
>
> Thanks,
> --b
> 


0
SusanV
5/2/2007 6:10:54 PM
Assuming the Field is in the Form's RecordSet... for example, for a Field 
named Boo, the click event would be

    Me.Boo = True            'Set the Yes/No Field
    Me.Dirty = False          'Cause Record to be Saved

 Larry Linson
 Microsoft Access MVP

<cbnewman@gmail.com> wrote in message 
news:1178128552.406004.222740@q75g2000hsh.googlegroups.com...
> What is the syntax for referring to the underlying record that a form
> is currently displaying?
>
> In other words, I would like to make a change to an attribute of a
> record that is being displayed when a user clicks a button. I believe
> the best way to do this is through modifying the VB code that
> underlies the onClick event, but I can't figure out how to reference
> the record that is being displayed in the current (or active) record.
>
> In this case, we're dealing with a boolean value (I realize that I
> could simply have the checkbox in the form, have the user check or
> uncheck the box, then submit the form. In this application, it is more
> intuitive to have the user click a button that will simultaneously
> commit the transaction and update the attribute). The user uses the
> form to search or navigate to a record of interest. When they click
> the "Discharge Patient" button, the boolean attribute "is_admitted"
> changes to false and the form exits.
>
> How do I reference or modify this data? Seems like I could generate a
> SQL statement and submit it (in this case, I would still have to know
> how to reference the current record within the SQL statement, I'm also
> not sure how to submit a SQL statement within VBA). But it also seems
> logical that there might be a way to modify the record within the form
> itself (i.e. set currentRecord.is_admitted to FALSE) using just VBA.
>
> Thanks,
> --b
> 


0
Larry
5/2/2007 6:14:58 PM
If the form is bound, then you can go:


me.NameOfBoField = true

However, if the form is bound at a runtime (ie: you change the reocrd source 
via code), then you find that the above will not work, and you have to use:


me!NameOfBolField = true


So, the code behind a buttion to change the field value, and then force a 
disk write of the current form would be:

me!NameOfBolField = true
me.dirty = False


-- 
Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com


0
Albert
5/2/2007 6:22:03 PM
On 2 May 2007 10:55:52 -0700, cbnewman@gmail.com wrote:

>How do I reference or modify this data? Seems like I could generate a
>SQL statement and submit it 

You're making it a LOT harder than it needs to be. Just include the field in
the Form's Recordsource query; you do not need to put a control on the form
for it. In your event simply put

Me!yesnofield = True

or whatever value you want to assign it.

             John W. Vinson [MVP]
0
John
5/2/2007 7:45:35 PM
Reply:

Similar Artilces:

Outlook Web Access AutoSignature
I would like to know if it's possible to have autosignature in Outlook Web Access, and if so how to implement it. If anyone can help, it would be greatly apreciated. Thank You. It depends on the version of Exchange - Outlook Web Access is a function of Exchange, not Outlook. Exchange 2003 does this natively, previous versions may have a third party add-in that will allow users to do this. For better information, post in an exchange group such as microsoft.public.exchange.admin. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due t...

Restricting access to note attachments
Hi all, is there a way to restrict access to attachments on notes to specified users. I know we can, using the Security Roles, define who can and can't read/ write the notes fields but we would like our users to be able to view the note, but not open the attachment(s) unless they are the owner of that note (or at least in the business unit, etc.). I know this could be done for Word/ Excel files in Office (Password protection) but are looking for something more encompassing for all attachments inside CRM. Thanks, -- Matt Pring On Oct 21, 3:54=A0pm, Matt Pring <MattPr...@discus...

Access 2003 and Access 2007 Synchronization
I'm setting up a new business relationship with a company in Portugal. They use Access 2003. I have just bought MS Office Professional 2007 (with Access 2007). Our plan is that they will send, once a month or so, their Access db then we will update and add to that db and then return it after another month or so. There probably won't be a lot of updates on our end so the monthly cycle should work. After they synchronize, they will send a new version of the db and we will start over. My goal is to keep everything as simple as possible partially because I don't know how skillf...

Excel Row to Access Columns
Hi, I have a single row in Excel with a lot of data, what I need to do is move that to a column in Access. I need some way to automate that. I know the easiest way to do that would to just transpose it in excel and then import in access.But I cant do that as I just get that excel file with one row and I need some way to automate the process in Access. thanks m -- mk389 ------------------------------------------------------------------------ mk389's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=15272 View this thread: http://www.excelforum.com/showthread.php?...

Help displaying a random record in a form--Access newbie
Hello, I am new to Access, so if anyone can help me, please assume I know absolutely nothing! I currently have a table with two columns, ID and CHORE. In each row, the ID number corresponds to a chore that I have entered. I would like to create a form with a button and a text field such that when I press the button, a random chore is displayed in the text field (supposed to make chores more "fun" for my son). There is no need to remove this record from future clicks (the same record can come up over and over without any problem for me) Can anyone explain to me (in pai...

Access
Hi My form takes a few moments to load up as it is fairly substantial SQL statement is there a way to get something to display a graphic or 'loading...' message to appear why it calculate the contents? Steve ...

Printing single record
HELP! I am using the following code under the ComandButton to print the current report from my form: Dim strWhere As String If Me.Dirty Then 'Save any edits. Me.Dirty = False End If If Me.NewRecord Then 'Check there is a record to print MsgBox "Select a record to print" Else strWhere = "[Num] = " & Me.[Num] DoCmd.OpenReport "Check Request", acViewNormal, , strWhere End If However, I keep getting the following error: The expression On Click you entered as the event property setting produced...

access mail on WEB
Is there a way i can check emails from exchanger server 5.5 from an internet browser. I have Exchange 5.5 in win NT 4.0. Thanks! Yes - install OWA (Outlook Web Access) and open up the needed ports in your firewall (80 for http; better to use SSL and port 443 instead). disk0nek wrote: > Is there a way i can check emails from exchanger server > 5.5 from an internet browser. > > I have Exchange 5.5 in win NT 4.0. > > Thanks! ...

access or mount mirrored hard disks
Hi, is it possible to access a mirrored harddrive? or mount the mirrored volume by using api or mfc commands? Thank you in advance Wimpi ...

Access Database In Great Plains
I was wondering if anyone knew how to have the databases that are stored in access transfered over to great plains. I'm current running version 8.0 any help would be greatful. thanks Search Customer Source for integration Manager. MS Access databases can be used as a data source. Vincev "jake" wrote: > I was wondering if anyone knew how to have the databases that are > stored in access transfered over to great plains. I'm current running > version 8.0 any help would be greatful. thanks > > Hi Jake, Is this something you need to do regularly or is it ...

CRM v4 Accessibility Improvements
Hi all: Does anyone know if any improvements have been med to CRM v4 in the area of accessibility for handicapped users? One of my customers has a user who is blind and they need to make the software accessible to him. Thanks in advance for any and all help. John. Hi John, We have added following Accessibility features in CRM 4.0 : 1) High Contrast Mode (Tools --> Options --> General Tab --> Enable high contrast settings) 2) All the Form input elements have <LABEL FOR> to aid in screen readers. 3) All the Images have a ALT tag (for non text elements) etc. Thanks! Ma...

Upsizing Access to SQL Server 2000
Hello, I am new to SQL Server. I am trying to use the Database upsizing wizard to upsize a Access 2000 database into SQL Server 2000. They are both on the same machine (running Win 03 Server). I cannot connect to the SQL Server. Error as below: Connection failed: SQLState: '01000' SQL Server Error: 14 [Microsoft][ODBC SQL Server Driver][Shared Memory] ConnectionOpen(Invalid Instance()). SQLState: '08001' SQL Server Error: 14 [Microsoft][ODBC SQL Server Driver][Shared Memory]Invalid connection. ...

Outlook Web Access #19
We have have OWA at my work and I would like to configure Outlook 2003 to synchronize with my desktop at work, is this possible Thanks B ...

Going offline without write access to registry
I suggest that POS doesn't go offline if it can't write into registry, displaying a message box instead telling that it couldn't access the registry. What happens if the POS machine goes offline without having access to edit the registry? This typically happen when the user is a normal user (not a power user) 1. The POS application will try to connect to the server main database within the pre-configured ‘Connect Timeout’ in the RMS Administrator (Typically 15 seconds) 2. The application will then try to connect to the pre-defined offline database (which is usually stored loc...

external HD previously recognized, currently not
I have an inspiron 8500 with XP SPK3 on it. The laptop came with XP Pro and the SPK's were added later. I have a buslink CO-80-U2FE that worked with Windows 98 and initially with XP maybe up to SPK2. I use it infrequently so I didn't find out until much later that it is no longer recognized after some of the upgrades. It has an external power supply. When I plug it into the USB port, nothing happens. Same thing when I plug it into another computer with newer OS, hadn't had the opportunity to try older. It doesn't show up in device manager either. Any suggestions f...

link to a record on a form
I have created a link from one form to a specific record on another using the following macro; Action: Open Form Where Condition: [ID]=[Forms]![Newspaper Query]![ID] This works perfect until I try to add the first for as a sub form to my home page form. When I click the link it first asks me to 'Enter Parameter Value - Forms!Newspaper Query!ID' If I type in the ID it will take me to the specified record but this is rather messy. Am I missing some code with this being changed into a subform? Bigbump, Not sure if I understand... I think you're saying that when your "...

Have a user account accessible to multiple users
I have an issue where there is a user account that has multiple alias emails.(reservations@domain.com, info@domain.com, CustomerService@domain.com) I have an exchange 2003 server. My issue is that i need to have muliple users access these emails so they are never missed. What is the best way to accomplish this? I was thinking a public folder. But i want to know the best way to do this? On Sat, 12 Jun 2010 21:37:04 -0500, "Dan V" <dvalenti54athotmail.com> wrote: >I have an issue where there is a user account that has multiple alias >emails.(reservati...

Access 2000 problem if opened with Access 2007
Dear all, I'm running Access 2000 MDE in Access 2007. I find several header-details form (such as invoice transaction), the details form is displayed as white box without any record displayed. Is there any solution for this matter ? Thanks. Chlaris. you need to move to Access Data Projects if you want a reliable, predictable environment "Chlaris" <chlarrissa_nospam@yahoo.com> wrote in message news:ON0rS1NsHHA.3884@TK2MSFTNGP04.phx.gbl... > Dear all, > > I'm running Access 2000 MDE in Access 2007. I find several header-details > form (such as inv...

Change Colours of Records
the Hi Is there a way to change the colours of screens if a different status of the record is selected? Thanks Mark ...

Money did away with many months of records
I had saved Micorsoft money to a floppy and a CD on Sept 3rd. The next day upon going to enter again my money had deleted everything back to May 2002. When I open a CD or floppy they all seem to go back to the page on the computer to year 2002. I found something saying each time I exit Money it is on the C drive. How do I go about restoring the lost months. THANKS It's incredibly hard to say given that what you describe doing is not a sufficient description and certainly doesn't sound like normal/best practices for managing a Money data file. Figure out where all of your ....

Accounting with Ms Access
Hello all I have been working on a database for are small retail Tile company (we do everything by pen and paper now). I have been able to setup a working Orders/Invoice table and forms, CreditMemo table and forms, and PurchaseOrder table and forms all based on the Northwind Sample Database. "Thanks to all the help here". I have been searching for a sample database with accounting. With A/R, A/P, Billing Statements and so on. I am not a programmer or accountant so the chance of me doing something wrong is pretty good. I am hoping that someone has a add-in MsAccess database for ...

BP3 Site Settings access
I've installed BP3 on web server as domain admin, with sep. SQL 2005 server for SPS and GP databases. On SQL2005 have given BusinessPortalUser full db rights. Site admin is sts_user, with domain admin rights in AD. When login to BP3 Home Page from domain admin, most features work 100%. However on Site Settings I get "the server (server) at Digest requires a username and password". Cannot login as domain admin, continually asks for username / pwd. When login as sts_user, Site Settings Center displays, with Registered Users section shows as below. Also cannot go to Users / Site...

Excel to Access
Hi group, quick question. If I have a macro to upload some Excel data into Access, can this macro be used by a user without Access installed on its PC???? The Access database is located in a shared drive, the Excel is stored in the user's PC. ....And same thing in the other way, can a user without Access import from Excel some Access info?? Versions are Excel 2003 and Access 2002. Thanks in advance, Cecilia Can you buy Excel without buying the entire Microsoft Office Suite? I'm not sure if there are variations in the way microsoft sells products in different countries s...

Access Levels
Hi I am having real difficulty in getting the access levels to work as I want them. Basically I want to control access at the Business Unit level. However, how do I know which business unit a specific account record belongs to? As far as I can see it is determined by the owner of the record and their corresponding Business Unit. Is this correct? Thanks You are correct. The record is only tied to the BU through the owner. Matt Parks ---------------------------------------- ---------------------------------------- On 26 May 2004 06:51:29 -0700, l.hargrave@btinternet.com (Lee) wrote: Hi I ...

Access and Accessibility
Does anyone know of a good resource for information about developing accessible applications using Microsoft Access 2003 or 2007? "Risikio" <Risikio@discussions.microsoft.com> wrote in message news:7BF54007-6C65-444E-BC25-84C90173AE8F@microsoft.com... > Does anyone know of a good resource for information about developing > accessible applications using Microsoft Access 2003 or 2007? As far as I know, all the Windows accessibility features are available in Office. Speech recognition improves with each version. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://w...