473,320 Members | 1,926 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,320 software developers and data experts.

forms: simple and complex question

Hi,

I'm trying to accomplish the following on a form on which i have
removed navigational buttons (I apologize in advance if this is too many
questions);

The two easy ones are....
1) When the user opens the forms I would like it to open to a blank
form so they can create a new record (I don't want fields populated with
the first record from the table). The user should also have the option of
searching for a particular record.

2) Would like to do some data testing done on the data the user
entered in the forms before it updates the table. Basically i would like to
concatenate a certain amount of zeros to what they entered using a loop.
Where do i place this code?

The more difficult one...
3) Would like to add a button to a form that would create and save a
CSV file by joining certain tables in the DB. The user should be prompted
to where he/she wants the file saved.

TIA

Nov 13 '05 #1
6 1892
1. Set the Data Entry (and Allow Additions) property of the form to "Yes"

2. Not sure what you mean by "data testing". You can use the Format
property of your controls to pad leading or trailing zeros (if that's what
you want).

3. A query of your two tables will create a recordset of the data in both
tables. Make that query a "Make Table" one and follow the prompts to select
a file type and location.

-Ed

"someguy" <in*********@yahoo.com> wrote in message
news:Xn*********************************@216.196.9 7.142...
Hi,

I'm trying to accomplish the following on a form on which i have
removed navigational buttons (I apologize in advance if this is too many
questions);

The two easy ones are....
1) When the user opens the forms I would like it to open to a blank
form so they can create a new record (I don't want fields populated with
the first record from the table). The user should also have the option of
searching for a particular record.

2) Would like to do some data testing done on the data the user
entered in the forms before it updates the table. Basically i would like
to
concatenate a certain amount of zeros to what they entered using a loop.
Where do i place this code?

The more difficult one...
3) Would like to add a button to a form that would create and save a
CSV file by joining certain tables in the DB. The user should be prompted
to where he/she wants the file saved.

TIA

Nov 13 '05 #2
Hi someguy,

I'm not too sure about Question 1...I think you can set the Form's
..CurrentRecord property to the last record, in the Form's OnOpen event
handler.

2) If you can write the code, you can either make it a public function
within a standard code module (i.e. in the VBE Project Explorer, under
'Modules') OR you can make it a private function within your form's
class module (i.e. in VBE Project Explorer, under 'Microsoft Access
class object')

3) I have done this before and tackled it in two ways:
Firstly, you can use the TransferSpreadsheet method in your button's
OnClick code, to transfer your data to a spreadsheet(which can be saved
as a .csv file). See the Help file in Access VBA for using this method.
Then, I suggest you read the following link, it has some useful tips on
automating Excel from another application - in your case saving the
file and prompting the user where to save.

Hope that helps!

Regards,
Jean

Nov 13 '05 #3
Hi Jean,

Thanks for your reply. Just another question about #2. I already
have the code written in a VBA module that works with an update query.
I have a button labelled "update" that transfers the form data to the
table. How do i call my code when this button is pressed? In the code,
how do i reference the fields values in the form?

Many Thanks,

Inderjit

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #4
Hi Ed,

Thanks for your suggestions, i'll try that as soon as i get a
chance. I have already tried what you sugguested in #1 but when i do
that i can't add a button to do a record search.

Thanks,

Inderjit

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #5
There seems to be a basic misunderstanding here. Most data entry forms have
a record source, so that the form's controls are "bound" to the underlying
table/query. You're working with a dynamic recordset and any
additions/edits/deletions are made immediately (actually, when Jet finds a
free moment) to the table/query. For that setup, there is no need to run
any update query or "transfer" data to the table. Access/Jet does all that
for you automatically.

The form's Allow Additions, Allow Edits, Allow Deletions, etc., properties
refer to the record source, NOT whether you can add/delete controls on the
form.

Look at Northwinds, or any of the template generated databases to see how
most developers and users set up data entry forms. Unbound forms and
controls are used mostly to capture user inputs that are not stored anywhere
and/or to show the results of calculations (that also should not be stored).
It is possible to set up unbound forms/controls for data entry, but why
spend all that time to try to fix something that's not broken?
-Ed

"Inderjit Rai" <in*********@rogers.com> wrote in message
news:42********@127.0.0.1...
Hi Jean,

Thanks for your reply. Just another question about #2. I already
have the code written in a VBA module that works with an update query.
I have a button labelled "update" that transfers the form data to the
table. How do i call my code when this button is pressed? In the code,
how do i reference the fields values in the form?

Many Thanks,

Inderjit

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #6
Just to #1 -
In the form's OnLoad event, you can use code like this:
DoCmd.GoToRecord , , acLast

HTH
- Turtle

"someguy" <in*********@yahoo.com> wrote in message
news:Xn*********************************@216.196.9 7.142...
Hi,

I'm trying to accomplish the following on a form on which i have
removed navigational buttons (I apologize in advance if this is too many
questions);

The two easy ones are....
1) When the user opens the forms I would like it to open to a blank
form so they can create a new record (I don't want fields populated with
the first record from the table). The user should also have the option of
searching for a particular record.

2) Would like to do some data testing done on the data the user
entered in the forms before it updates the table. Basically i would like to concatenate a certain amount of zeros to what they entered using a loop.
Where do i place this code?

The more difficult one...
3) Would like to add a button to a form that would create and save a
CSV file by joining certain tables in the DB. The user should be prompted
to where he/she wants the file saved.

TIA

Nov 13 '05 #7

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

Similar topics

1
by: Volker Zink | last post by:
I am writing my first schema and have 3 complex types which represent "top level objects": <complex type name="A1"> .... </complex type> <complex type name="A2"> .... </complex type>
25
by: Steve Jorgensen | last post by:
Yup, Steve's full of tips, but hey, it makes him feel important, right? Ok, here goes. I've been trying to improve encapsulation by putting code in the same object as the stuff it affects, so I...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
2
by: James X. Li | last post by:
Is there a way to implement multiple login forms for ASP.NET applications? With our application we want to implement simple login form for normal resources (downloadable files), but more rigorous...
5
by: ~~~ .NET Ed ~~~ | last post by:
Hi, As you all know when an ASP.NET web form is created that will include web controls and such, it contains a FORM that that identifies the web form and its containing controls. Well, I have a...
7
by: abcd | last post by:
I am trying to set up client machine and investigatging which .net components are missing to run aspx page. I have a simple aspx page which just has "hello world" printed.... When I request...
34
by: Luke | last post by:
Hi! I am new to PHP but I am a very experienced in Perl/CGI/templates. I work in medical informatics when we deal with very large data collection forms. Some of them have over 1000 elements!...
9
by: garyusenet | last post by:
I am using a C# solution that somebody kindly sent me. It was a console application. I am trying to get use of the MessageBox. I have added the following using directive to the namespaces at...
19
Atli
by: Atli | last post by:
Introduction At some point, all web developers will need to collect data from their users. In a dynamic web page, everything revolves around the users input, so knowing how to ask for and collect...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.