Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: how to use the inputbox to request a value


Message #1 by "David Evans" <ddgevans@t...> on Sat, 10 Feb 2001 22:30:27
I am new to developing Access Databases and am at the moment creating a Database to replace an existing
loborious Excel spreadsheet. I have created a frontend menu and 4 Forms that are opened by Click events. The forms themselves are
Unbound and I have set a DAO.recordset to populate the form with several subs and functions that update and delete.  The problem is
that I have created another form that actually does the calculations, but I cannot figure out how to use the inputbox to request a
value and then update each record in the recordset if a txt field has a value and ignore it if it does not. i have tried the Do
While a_memberTran.EOF loop but it just goes into a never ending loop and cannot figure out why. 



Please help 



Message #2 by "Bob Bedell" <bdbedell@m...> on Sun, 11 Feb 2001 01:31:18 -0500
Try Do Until...Loop instead of Do...While



-----Original Message-----

From: David Evans [mailto:ddgevans@t...]

Sent: Saturday, February 10, 2001 10:30 PM

To: Access

Subject: [access] how to use the inputbox to request a value





I am new to developing Access Databases and am at the moment creating a

Database to replace an existing loborious Excel spreadsheet. I have created

a frontend menu and 4 Forms that are opened by Click events. The forms

themselves are Unbound and I have set a DAO.recordset to populate the form

with several subs and functions that update and delete.  The problem is that

I have created another form that actually does the calculations, but I

cannot figure out how to use the inputbox to request a value and then update

each record in the recordset if a txt field has a value and ignore it if it

does not. i have tried the Do While a_memberTran.EOF loop but it just goes

into a never ending loop and cannot figure out why.



Please help












Message #3 by "David Evans" <ddgevans@t...> on Sun, 11 Feb 2001 17:48:50 -0000
Thanks for that but I still can't get it to do what I want it to do.  I have

attached the code for you to look at and tell mee where I am going wrong.



Private Sub cmdEnterMoney_Click()



     Dim sMoney As String

     Dim vMoney As Variant



     Do Until a_MemberTran.EOF



         If UpdateRow1() Then

                sMoney = InputBox("How much Money has been Received?", _

                          "Money Received..", "")



                    If IsNumeric(sMoney) Then

                    vMoney = a_MemberTran.Bookmark

                    a_MemberTran.FindFirst ("MoneyIn = " & sMoney)



                        If txtHoneyKgs is not null then

                        txtMoneyIn = sMoney

                        End if

                    End If

    a_MemberTran.FindNext

        End If

    Exit Do

    Loop





    a_InfoChanged = True

    txtMoneyIn.Visible = True

    Call txtMoneyIn_AfterUpdate







End Sub



I apologise if I am missing the obvious but as I said it is totally new to

me.

----- Original Message -----

From: Bob Bedell <bdbedell@m...>

To: Access <access@p...>

Sent: Sunday, February 11, 2001 6:31 AM

Subject: [access] RE: how to use the input box to request a value





> Try Do Until...Loop instead of Do...While

>

> -----Original Message-----

> From: David Evans [mailto:ddgevans@t...]

> Sent: Saturday, February 10, 2001 10:30 PM

> To: Access

> Subject: [access] how to use the inputbox to request a value

>

>

> I am new to developing Access Databases and am at the moment creating a

> Database to replace an existing loborious Excel spreadsheet. I have

created

> a frontend menu and 4 Forms that are opened by Click events. The forms

> themselves are Unbound and I have set a DAO.recordset to populate the form

> with several subs and functions that update and delete.  The problem is

that

> I have created another form that actually does the calculations, but I

> cannot figure out how to use the inputbox to request a value and then

update

> each record in the recordset if a txt field has a value and ignore it if

it

> does not. i have tried the Do While a_memberTran.EOF loop but it just goes

> into a never ending loop and cannot figure out why.

>

> Please help

>

>




>

>

>




>



Message #4 by "Bob Bedell" <bdbedell@m...> on Tue, 13 Feb 2001 00:29:28
Hi David,



I'm prettty new at this too. Wish there was a bit more traffic on

the Acces page...but. The reason I suggested trying a Do Until...Loop

was that your code, as originally written, generates an infinite loop. 





Do While a_MemberTran.EOF

...

Loop



is your original code. I probably should have suggested:



Do While NOT a_MemberTran.EOF

...

Loop



rather Do Until....Loop. Try it.



The EOF property is a buffer at the bottom of the recordset, not a 

record itself. Its the record after the last record. When you loop 

through a recordset and reach EOF, it's value is set to True. If your 

code reads "Do While EOF", the loop keeps iterating because it keeps

evaluating to EOF = True.



If you use Do While Not EOF, your code will terminate, ending your

infinite loop problem. But thats all that occurs to me at the moment.

Message #5 by "David Evans" <ddgevans@t...> on Tue, 13 Feb 2001 16:57:35 -0000
Thanks I solved My problem, by calling another form to input a variable and

then used a With Wend statement which has worked well.



Thanks



Dave

----- Original Message -----

From: Bob Bedell <bdbedell@m...>

To: Access <access@p...>

Sent: Tuesday, February 13, 2001 12:29 AM

Subject: [access] RE: how to use the input box to request a value





> Hi David,

>

> I'm prettty new at this too. Wish there was a bit more traffic on

> the Acces page...but. The reason I suggested trying a Do Until...Loop

> was that your code, as originally written, generates an infinite loop.

>

>

> Do While a_MemberTran.EOF

> ...

> Loop

>

> is your original code. I probably should have suggested:

>

> Do While NOT a_MemberTran.EOF

> ...

> Loop

>

> rather Do Until....Loop. Try it.

>

> The EOF property is a buffer at the bottom of the recordset, not a

> record itself. Its the record after the last record. When you loop

> through a recordset and reach EOF, it's value is set to True. If your

> code reads "Do While EOF", the loop keeps iterating because it keeps

> evaluating to EOF = True.

>

> If you use Do While Not EOF, your code will terminate, ending your

> infinite loop problem. But thats all that occurs to me at the moment.

>

  Return to Index