I'm brand new at this and I'm making my first Access 2003 database. I would think my question is a real easy one.
The database is real simple with only 1 table. I created a form to get input from the user. Using the button wizard, I created an "Add Record" button that the user clicks when finished. When the button is clicked the VB code listed below runs. But before the code is finished, I want to assign values to 2 fields in the table for the record the user just created. I want to add today's date to a field called "DateEntere d", and then set a Yes/No field called "Complete" to "yes".
I should be able to enter a couple simple lines in the code below where the "?????" is. The problem is, I don't know how to write those lines. Can anyone tell me how to do it?
Thanks.
Private Sub Command0_Click( )
On Error GoTo Err_Command0_Cl ick
DoCmd.GoToRecor d , , acNewRec ?????
Exit_Command0_C lick:
Exit Sub
Err_Command0_Cl ick:
MsgBox Err.Description
Resume Exit_Command0_C lick
End Sub
4 2349
Good ay ,
I use an orderdate field on my main form and on entering a new record it just fills in the field order_date (on the current form) by useing the date function
Me.Order_date = Date
to fill in the other field (if it's got a field on the form) just use Me.fieldname = data
southoz
ADezii 8,834
Recognized Expert Expert
Set the Default Valued to these Fields as follows:
[DateEntered] = Now()
[Complete] = Yes
Anytime that you add a New Record these Fields will automatically be set to these Values. Hope this helps.
MMcCarthy 14,534
Recognized Expert Moderator MVP
Try this: -
-
-
Private Sub Command0_Click()
-
On Error GoTo Err_Command0_Click
-
-
Me.DateEntered=Date
-
Me.Complete=-1
-
-
DoCmd.GoToRecord , , acNewRec
-
-
-
-
Exit_Command0_Click:
-
Exit Sub
-
-
Err_Command0_Click:
-
MsgBox Err.Description
-
Resume Exit_Command0_Click
-
-
End Sub
-
-
Thanks. I'll give those ideas a try.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: RobG |
last post by:
I am trying to dynamically add an onclick to an element,
however I just can't get the syntax right. consider the
following function:
function doClick (evt,x) {
// do things with evt and x
}
Which is called statically by:
<button onclick="doClick(event,this);">Click me</button>
|
by: Mathew Hill |
last post by:
I am a beginner to the more technical aspects of Microsoft Access
(2000) and was wondering if any one can help. I have 3 buttons on a
form which add, delete and search for a record. However, when I click
on the respective buttons absolutely nothing happens! I was wondering
if anyone could help? The code I have is below...
ADDING A RECORD
Private Sub cmdaddstudent_Click()
On Error GoTo Err_cmdaddstudent_Click
|
by: Jim Heavey |
last post by:
Trying to figure out the technique which should be used
to add rows to a datagrid. I am thinking that I would
want an "Add" button on the footer, but I am not quite
sure how to do that. Is that the best method? Do you
have a sample of how to do this?
|
by: Dmitry Korolyov [MVP] |
last post by:
When we use
btnSubmit.Attributes = "javascript: this.disabled=true;"
to make the button disabled and prevent users from clicking it again while
form data still posting, there is no longer postback. I.e. the button does
go disabled, but the form does not invoke submit() method. Of course, it
does work fine without this property.
Clues?
|
by: Sileesh |
last post by:
Hi
I have html table and a Button in an Aspx page. I am adding one row with
some textboxes to Html table each time i click on the Button thru Javascript.
Now problem is when when i try to collect the data in the Textboxes which i
added dynamically from server side, i am not able to do . Alos i tried to
bedug, the total no of rows in Html table does not reflect the dynamically
added rows.
| |
by: seanmayhew |
last post by:
I have a form page that that while editing saves the data to an xml doc
before submitting to db. On each page
unload it saves the xmldoc as the user can add multiple items to the
company like product types etc. So for
instance Im adding a fruit company while adding a fruit company I allow
the user to add types of fruit they
carry and display it dynamically using an <asp:table> with image
|
by: Ankit Aneja |
last post by:
I have a strange situation and I have no idea how to solve this.
Its a Recruitment Search Page,in the Admin Page, for every button click
event the Admin Person has to create a checkbox on the users page. So
whenever the Admin person comes to know about the new category in the market
he will be adding as different Sub-Categories for example ABAP, BDC
etc..etc.. on every click event as Checkboxes. And these
controls(checkboxes) should remain...
|
by: Simon Jefferies |
last post by:
Hello,
I am trying to add an item to a checked list box, like:
clbList.Items.add("Hello",true)
I get an error back:
Run-time exception thrown: System.ArgumentOutOfRangeException - Specified
argument was out of the range of valid values. Parameter name: '-1' is not a
|
by: Neo Geshel |
last post by:
I have strip-mined, strip-searched, and completely exhausted the
Internet (up to the 30th page on Google, with 100 results per page!!),
all without finding an answer to my question AS TO WHY IT IS IMPOSSIBLE
TO PROGRAMMATICALLY ADD A BUTTON TO A DYNAMICALLY CREATED PAGE.
Or, to be more precise, why it is impossible to have an onClick sub
respond to that button’s Click event.
My main page has only one line:
|
by: ChrisCicc |
last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have been able to find the cause of the problem, and will describe it here first textually and then through a code example.
The purpose of what I am trying to do is to create a postback-free web application through the use of ASP.net AJAX UpdatePanels...
|
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: 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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: 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: 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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |