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

Newbie needs help

I am new to access and have absolutley no training. I am familiar with other db applications, but this is the one that has been given to me to work with. I have a simple database consisting of 2 tables. Table 1 (BookInfo) contains a barcode, checkin, checkout and inout flag among other fields. Table 2 (ScanInfo) contains a barcode and scandate field. Both tables will eventually get bigger, but this is what I am starting with. What I want to do is Scan a book in to ScanInfo then, OnExit from the barcode field run the following script:

Private Sub BarCode_Exit(Cancel As Integer)

If ([InOutFlag] = True) Then
[LastOut] = Date
[InOutFlag] = False
Else
[LastIn] = Date
[InOutFlag] = True
End If


End Sub


First, I am not sure what Cancel As Integer means, it was in their by default when I created the script and the script doesn't seem to run without it.

Second, even though the script runs, it does not appear to do anything. I believe it is because I haven't saved the record in Table1, but I can't locate a command to do that.

If I knew what I was doing, this would be simple. I have already spent too much time looking around for help on this, so I hope someone here can make me not so clueless.

Thanks
May 21 '10 #1
1 982
missinglinq
3,532 Expert 2GB
First, I am not sure what Cancel As Integer means, it was in their by default when I created the script and the script doesn't seem to run without it.
This means that you can Cancel exiting the control in question, the textbox BarCode, in this case. If you had the need to do that you would use

Cancel = True

And yes, the Exit event it will not run without Cancel As Integer in the sub header. Never change the sub headers that Access generates, and never try to add things like Cancel As Integer to sub headers that Access generates that lack it; it also won't work.

Second, even though the script runs, it does not appear to do anything. I believe it is because I haven't saved the record in Table1, but I can't locate a command to do that.
You have to actually Exit the BarCode textbox before the code will execute.

In Access, you don't normally need a "save" button, as Access is designed to save a record when you either move to another record or close the form. If there is a reason to force an explicit save, you can use

If Me.Dirty Then Me.Dirty = False

Since you only have one other control on your form, and you're filling that thru code, I'm guessing that you haven't exited the BarCode textbox. If you move to another record or close the form while the cursor is still in it, its Exit event will fire.

In Access, when referring to a control such as a textbox, from within its own code module we use the preface Me. So your code would read
Expand|Select|Wrap|Line Numbers
  1. Private Sub BarCode_Exit(Cancel As Integer)
  2.  
  3.   If Me.InOutFlag = True Then
  4.     Me.LastOut = Date
  5.     Me.InOutFlag = False
  6.   Else
  7.     Me.LastIn = Date
  8.     Me.InOutFlag = True
  9.   End If
  10.  
  11. End Sub
If I knew what I was doing, this would be simple. I have already spent too much time looking around for help on this, so I hope someone here can make me not so clueless.
I have to say that you really, really need to get a book or two and do some reading to get a basic idea of how things work before attempting to develop your database! While Access allows for the rapid development of databases, it is very complex program and not something you can "jump into and figure out" in the same way that you would, say, a word processing program or even a graphics program.

The mission of this forum is to answer specific questions about specific technical problems, and the people responding here are always happy to do so, but we expect the posters to have put out a certain amount of effort to both learn Access and to solve their problems before coming here.

So using the info above, give this a try and see what happens. If you have problems, come back here with the details and we'll see what we can do.

And read a book or two!

Welcome to Bytes!

Linq ;0)>

Moderator
May 21 '10 #2

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

Similar topics

0
by: igmox | last post by:
hi, i am a complete newbie and got stuck. my question is about costumers and prices Customer_ID CustomerName CustomerType 1 John 2 2 Joe ...
0
by: Statsstudent2006 | last post by:
Hello! I am a newbie, and have received my first VBA assignment. I have to write a subroutine that generates the Fibonacci sequence of numbers (the first n numbers, where n is an integer number...
1
by: bzbee | last post by:
Hello I ran across this site by accident & hope someone can help me. I know this sounds stupid .But I need to know how to type SCANREG in at Dos prompt. I know nothing about Dos prompt. I...
23
by: Gunnerman6875 | last post by:
Hi everyone, Well I'm a newbie to Access and your site so forgive me if my terminology is a little out. I'm currently trying to create what i thought would be a simple database for work. I'm in...
6
by: diediealldie | last post by:
I'm really really newbie, almost no knowledge about python. The problem I have is : example) a = for n in a: if a < 4: del a if I code like this, an error occurs, because...
3
Metallicat
by: Metallicat | last post by:
I have been posed and attempted to answer several questions but I do not seem to be getting anywhere. I have emailed my tutor a week ago and he has not responded, If anyone can take a look and help...
3
Eclipse
by: Eclipse | last post by:
G'day All I am just starting to learn programming and need a bit of help with this one. I want to be able to create a list containing Path, Directory, Filename and write them out to a csv file...
4
bencoding
by: bencoding | last post by:
Hello, I've been learning C# for a few months now and still learning, I come from a PHP background where declaring the variable types is not involved. I would like to do this simple math...
2
by: Luis Speciale | last post by:
Hi I'm trying to build mod_pyton on Leopard 10.5.4 on a Mac G5 with this cvs version http://svn.apache.org/repos/asf/quetzalcoatl/mod_python/trunk with this Python python Python 2.5.2...
2
by: shawnwperkins | last post by:
Hi Folks, I'm new to Javascript and just need a little help. I downloaded a script from Dynamic Drive's Web site and I'm trying to make a simple modification and could use some help. :) The...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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$) { } ...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.