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

How can I save my results?

I am creating a DB that contains 2 listboxes in my form and a command button to return results based on both selections in the listboxes. I need a save button to save the reults that are shown in a table. Can anyone tell me if this is possible? If so, how can I create the button so it is enabled after the results are showed?
May 17 '07 #1
1 1159
MMcCarthy
14,534 Expert Mod 8TB
I am creating a DB that contains 2 listboxes in my form and a command button to return results based on both selections in the listboxes. I need a save button to save the reults that are shown in a table. Can anyone tell me if this is possible? If so, how can I create the button so it is enabled after the results are showed?
Firstly behind the save button you will need code somthing like the following:
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2.  
  3.    strSQL = "INSERT INTO TableName (Field1, Field2) VALUES ('" & _
  4.       Me!Listbox1 & "', '" & Me!Listbox2 & "')"
  5.    DoCmd.RunSQL strSQL
  6.  
I have assumed in the above code that both listboxes are returning string values. If they are numbers then remove the single quotes.

As for enabling the button. Set the button to
Expand|Select|Wrap|Line Numbers
  1. Me!BtnName.Enabled = False 
in the Form open event.

In the After Update event of both listboxes set the following:
Expand|Select|Wrap|Line Numbers
  1. If IsNull(Me!Listbox1) Or IsNull(Me!Llistbox2) Then
  2.    Me!BtnName.Enabled = False
  3. Else
  4.    Me!BtnName.Enabled = True
  5. End If
May 22 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Aliza Klein | last post by:
I am new to ASP so please pardon me if this is crazy. I have data that I want to allow the user to be able to save in a format that will then enable the user to open the data in Excel. (I have...
0
by: F. Hall | last post by:
If I read a bitmap image from one file and save it to another the save operation is slow unless I draw on the image. In other words, Image inputImage = Image.FromFile( @"c:\temp\source.bmp" );...
1
by: Trillium | last post by:
I am trying to query a SQL Server database, retrieve the results as XML, and save them to a file. I was trying to use the SqlXmlCommand, SqlXmlCommandType.XPath and an xsd to query the database,...
5
by: Carl | last post by:
Please can anyone tell me how I can create a macro to save the results of a query as an excel file? The query is called Student List and I would like to save it to "My Documents". We have had...
9
by: Mark Johnson | last post by:
How can you save all or a portion of the Grafics object to a Image/Bitmap ? I am try to save the Images from Cards.dll to a BitMap file. I can read in the Images to the Grafics, but when I try this...
7
by: joseph.inglis | last post by:
I have a web browser object on a form which I have set to edit mode and use the UCOMIConnectionPointContainer interface to hook in and catch events. All working sweetly. Except there...
5
by: kevin | last post by:
Hi, Any help with this would be really appreciated! I'm trying to download a file from a remote server. The access permissions is okay but the problem I'm facing is that the file is getting...
7
by: mark | last post by:
Hi All, Apologies for the newbie question but I've searched and tried all sorts for a few days and I'm pulling my hair out ; Please feel free to teach me to suck eggs because it's all new to me...
6
scubak1w1
by: scubak1w1 | last post by:
Hello, I have been Googling for a bit now as to how to let the user save the current page via a 'clickable icon' to an HTML file (i.e., on the client side.) That is, I am presenting a lot of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
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,...
0
jinu1996
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...

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.