home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

Access Database

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1468
Discussions: 200,927, Posts: 2,379,135, Members: 246,293
Old September 29th, 2003, 03:17 AM   Digg it!   #1 (permalink)
Member
 
Join Date: Sep 2002
Location: Shirley, New York
Posts: 257
Send a message via AIM to Paluccie
Access Database

Ok

I'm using Microsoft Access for my customer database. I have a table that has a list of serial numbers that I will need to input into a text box. I have the form created already. Now, what I want to do is create a button where it will take a number from the serialnumbers table and input it into the text box, but also remove it from the serialnumbers table. If anyone knows how to do this, i'm open for all suggestions. Thanks in advance.


Table with serial numbers is called
serialnumbers

Text box that i'm using is
SerialNumber

Thanks again!
Paluccie is offline   Reply With Quote
Old September 29th, 2003, 03:22 AM     #2 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,384
ok to clarify
You have a table of (probably) unique serial number

You want to
Push button
-- Fetch S/N from S/N table
-- Put S/N into text field on form
-- Delete given S/N from table of available S/N's?

If so best method would be to create a quick macro
I don't have access available at the moment, so maybe poke around google for retrieving recordsets from Access tables

If Access was a decent DB (we won't get started) you could chain together SQL Statements, but I don't think you can do that in access

The other option (that I can think of) would be to use seperate buttons. One for fetch, the other to delete.
__________________
Helicopters don't fly; they vibrate so much and make so much noise that the earth rejects them.
vass0922 is offline   Reply With Quote
Old September 29th, 2003, 03:24 AM     #3 (permalink)
Member
 
Join Date: Sep 2002
Location: Shirley, New York
Posts: 257
Send a message via AIM to Paluccie
yeah

yeah that's what i want to do
Paluccie is offline   Reply With Quote
Old September 29th, 2003, 09:49 AM     #4 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: New Hampshire, USA
Posts: 641
What I would do is probably a bit more complicated, but I will share it anyways.

CONCEPT:
Take the table of serial numbers and add a check box field so that when you use a serial number on a form, that you could check the check box in the serial number table. then, when you exit the database I would have it run a delete query where it would delete all records from the serial number table where the value stored in the check box is "-1".

FORM DESIGN:
1 - When you would open the form you already have, I would create an ONCURRENT event on your form ([frmYourForm]) that would open a second form [frmSerialNumberLookup] bound to the serial number table.

2 - This second form would have two controls on it:
[frmSerialNumberLookup]![txtSerialNumber] to show the serial number
[frmSerialNumberLookup]![cbxDelete] to mark the record as ready to be deleted


The row source for this second form should be set to something like

SELECT MIN [Serial number] FROM tblSerialNumbers WHERE cbxDelete = 0.

This second form ([frmSerialNumberLookup]) would have an ON OPEN event that would take the serial number value displayed on the second form and paste it in your form. Syntax would look something like this.

[frmYourForm]![txtSerialNumber] = [frmSerialNumberLookup]![txtSerialNumber]


[frmYourForm]![txtSerialNumber].requery


docmd.close "frmSerialNumberLookup"

3 - I would have an ON CLOSE event for [frmSerialNumberLookup] that would set the value of [frmSerialNumberLookup]![cbxDelete] equal to "-1"

Perhaps this is not the most eefficient method of doing this, but it should work for you.

Last edited by ctaylor : September 29th, 2003 at 09:52 AM.
ctaylor is offline   Reply With Quote
Old September 29th, 2003, 09:50 PM     #5 (permalink)
Member
 
Join Date: Sep 2002
Location: Shirley, New York
Posts: 257
Send a message via AIM to Paluccie
Maybe if I attach the files this might help better.
Paluccie is offline   Reply With Quote
Old September 29th, 2003, 11:04 PM     #6 (permalink)
Ultimate Member
 
elmers's Avatar
 
Join Date: Sep 2003
Location: Philadelphia
Posts: 1,484
vass0922: I think you can use sql in access. I did some nice little macros with a command somthing like sqlcommand or something for my db class.
__________________
Buy the ticket, take the ride.
- Hunter S. Thompson
elmers is offline   Reply With Quote
Old September 30th, 2003, 05:08 PM     #7 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: New Hampshire, USA
Posts: 641
<BRAIN DUMP>concerning the use of SQL statements with MS Access here are my immediate thoughts:

1 - What you can do in MS Access' VBA modules is define a string variable such as strSQL

You can then set strSQL equal to a SQL statement surrounded by quotation marks.

With a recordset object you can sefine the source property (rstTemp.source = strSQL) by setting it equal to the variable strSQL.

I'm not sure how helpful this is as I have never been able to do much with displaying the results of a record set.


2 - you can write queries directly with SQL language by going into SQL VIEW instead of design view


3 - you can manually set the record source property of a data control equal to an SQL statement. Programatically, you can set the record source property equal to a variable and define the variable within a VBA module based upon certain criteria you define.

4 - when using DDE, you can overcome the MS Access 255 character limitation of a SQL string be defining string variables that contain SQL clauses (such as the SELECT clause, FROM clause, WHERE clause etc). Compose your SQL string by concatonating the string variables together to create a SQL string that contains effectively contains more than 255 characters even though the explicit declaration of the SQL string (in the final step where you concatonate the clauses) contains less than 255 characters.

5 - a docmd.runSQL method also exists to run 'action queries'

<BRAIN DUMP>

Last edited by ctaylor : September 30th, 2003 at 05:11 PM.
ctaylor is offline   Reply With Quote
Old October 1st, 2003, 04:02 PM     #8 (permalink)
Member
 
Join Date: Sep 2002
Location: Shirley, New York
Posts: 257
Send a message via AIM to Paluccie
Alright, I'm kind of new at all this SQL and query stuff, just trying to get somethings going. I am a hardware type of person not software. Anyway, if anyone knows the code or has documentation on how I would go about doing this, I would appreciate all the help. Everything that has been said, is kind of like in a different language, I understand what I have to do, now its just going ahead and doing it, is the problem. Any help that you can give will be appreciated.

Table that contains the serial numbers is called
table= serialnumbers

The form that will have the button that will be called
button Name= GetSerialNumber
Caption = Get Serial Number
form = ComputerInfo

Any other info, just ask! Thanks for the help, I appreciate it very much!
Paluccie is offline   Reply With Quote
Old October 2nd, 2003, 01:03 AM     #9 (permalink)
Banned
 
Join Date: Sep 2003
Posts: 35
Quote:
I am a hardware type

aren't we all?

If you want to play around with stuff, learn how it works, or not!
pedantic is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2866)
Obama the Muslim (14)
Is the PSU I received dead? (10)
windows vista security holes (9)
HIS HD5770 graphic card question (15)
Foreign voltage (10)
Print spooler problem (13)
Install XP pro and a Vista laptop ?.. (10)
Dept. of HS: NSA 'Helped' Develop V.. (15)
A good PSU? (10)
Ideal cheap graph card for PC-Gamin.. (15)
New Computer wont recognize XP disc (7)
EVGA 9800 gtx help with finding a g.. (8)
World's largest Monopoly Game using.. (331)
Recent Discussions
Fire in DVD (2)
Safe International POS for CC,DC cash.. (0)
Regular Build (0)
Modern Warfare For the PC (33)
radeon x850xt platinum & shader 3 (3)
Have you switched yet? (84)
Install XP pro and a Vista laptop ?? (10)
Wireless Router+Cable Modems and Much.. (0)
Optical Audio A-B Switch (1)
windows vista security holes (9)
The NTDVM CPU has encountered an ille.. (24)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (34)
Wireless speakers for PC? (11)
Print spooler problem (13)
Help getting around port 80 for camer.. (2)
Display shows 3x5 inch in middle of s.. (3)
monitor will not turn on at all, (1)
World's largest Monopoly Game using G.. (331)
Foreign voltage (10)
FiOS modem/router interfering with ne.. (7)
Browsers wont load websites (2)
Virus Doctor Popup? (1)
Dept. of HS: NSA 'Helped' Develop Vis.. (15)
EVGA 9800 gtx help with finding a goo.. (8)
Problem with speed step/turbo boost? (1)


All times are GMT -4. The time now is 02:04 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28