Compile Error

N

NEC-2008

I need to know what I'm doing wrong. I'm tring to get a form number to
count..1,2,3...ect and I keep getting a "Compile Error".
Can anybody help me out?

tbl_FormNumber_A
Field Name Data Type
StartNumber_A Number
StopNUmber_A Number

frm_FormNumber_A
StartNumber_A text box (this form used to enter
the batch
StopNumber_A text box numbers of the forms)

The code that I put in the "FormNumber" text box on the form itself is at
the beforeinsert location.
The Code:

Private Sub Form_BeforeInsert (Cancel As Interger)
Me![FormNumber_A] = Next _Start_Number_A ()
If Me.FormNumber_A = DLookup ("StopNumber_A",
"tbl_FormNumber_A") - 10 Then
MsgBox "The current batch numbers are about to run out"
End If
End Sub

This gives me a Compile Error of "Sub or Function Not Defined"
at .....Next_StartNumber_A ()

Can anyone help with this? Thanks in advance.
 
L

Lord Kelvan

umm is Next _Start_Number_A a field in a table or where is that
comming from.because you are treating it as a function placing the ()
after it

Regards
Kelvan
 
N

NEC-2008

StartNumber_A is a field in the table tbl_FormNumber_A. It is where the
batch numbers are heald. Starting number and stop number (ie...start
500...stop 499)
 
M

Mike Painter

NEC-2008 said:
StartNumber_A is a field in the table tbl_FormNumber_A. It is
where the batch numbers are heald. Starting number and stop number
(ie...start 500...stop 499)
Yes and Access sees " Next_StartNumber_A ()" as a function.
 
L

Lord Kelvan

try to use the dlookup thing that you are using in the if statement
not sure if it will work as i dont use the D functions

Regards
Kelvan
 
N

NEC-2008

OK I'll do that and get back to you...may take a day or two so don't loose
the post.
Thanks for the direction.
NEC 2008
 
N

NEC-2008

Correct me if I'm wrong:
If this is a function, and the program is looking for a function to go to
and follow, and its not a built in (such as date() time()...), would I not
build the function in a module for it to follow?????
 
L

Lord Kelvan

a public function in a module would work if you made it do what you
want it to do

Regards
Kelvan
 
N

NEC-2008

Good news...It worked. Wrote the function to look at the table and get the
sequence of numbers, pick one, put it in the text box and count it out as the
first entry is made. Thanks a lot for your sending me in the right direction.
NEC 2008
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top