AddNew DON'T work, Need HELP!!! 
Author Message
 AddNew DON'T work, Need HELP!!!

Hi there!

        I have a problem that I can't figure out... it theory it is a very
simple procedure. I want to add a new record to a table named "Changes".

from VB I have to data controls data1, data2 on the same form.

Data1 is the one connected to the the table "changes" data2 is connected to the
table "Files"

Now, when a user wants to add a record, a change, In order to validate the
file name, I have a combo box (data2) that lists the valid file names
in the table files <- data2. This is to avoid user error when they enter the
data.

So I have a button called "change name" that lists the valid field names,
by populating the combobox.

So far so good... now, after they clicked the AddNew button (data1.AddNew),
The only 3 buttons available are cancel, update (to save the record) and
change field name. So they are supposed to go select the name of the file from
the combobox, and  enter information about the changes made to the file.

Then when all is done they are supposed to click Update to save the records.

The PROBLEM is... IT IS NOT ADDING A NEW RECORD! It OVER writes the record
that was there...

So I only have one record at any time! Addnew, movenext moveprevious
thats all that is should take no?

Now, pehaps the fact that I have the following upon loading the form
data1.recordsource = (find all record for the current projectid)

and data2 is only used to populate the combo box, then I do a
data1.edit
data1.recorset.fields("Name").value = combo1
data1.refresh

data1.movenext
data1.moveprevious

Why isn't adding the record? is data1 pointer not moving at all?
Do you think this comes from setting data to the recordsource query, I don't
think so, since I do the same on a similar form and I can still addnew and
delete records.

I am stuck good! In fact i don't think that the name field is geting updated
when I say ....("name").value = combo1.

Arrghhhh!!!

Any suggestions? If you need more info I will be more than glad to
send the code.

Thanks a million.

George



Mon, 18 May 1998 03:00:00 GMT  
 AddNew DON'T work, Need HELP!!!
: Hi

: Shouldn't it be Data1.recordset.addnew or did you just forget to write the recordset. the same
: goes for the rest.

: Data1.recordset.movefirst
: Data1.recordset.movelast
: andsoon

: Hope this helps

: Anders


: >
: >The PROBLEM is... IT IS NOT ADDING A NEW RECORD! It OVER writes the record
: >that was there...
: >
: >
: >So I only have one record at any time! Addnew, movenext moveprevious
: >thats all that is should take no?
: >
: >Now, pehaps the fact that I have the following upon loading the form
: >data1.recordsource = (find all record for the current projectid)
: >
: >and data2 is only used to populate the combo box, then I do a
: >data1.edit
: >data1.recorset.fields("Name").value = combo1
: >data1.refresh
: >
: >data1.movenext
: >data1.moveprevious
: >

No...

Now the whole program does not work.... I wonder if it is a database error.

Sometimes when I try to open the access table it does not work.

SUCKS!



Tue, 19 May 1998 03:00:00 GMT  
 AddNew DON'T work, Need HELP!!!
Hi

Shouldn't it be Data1.recordset.addnew or did you just forget to write the recordset. the same
goes for the rest.

Data1.recordset.movefirst
Data1.recordset.movelast
andsoon

Hope this helps

Anders

Quote:

>The PROBLEM is... IT IS NOT ADDING A NEW RECORD! It OVER writes the record
>that was there...

>So I only have one record at any time! Addnew, movenext moveprevious
>thats all that is should take no?

>Now, pehaps the fact that I have the following upon loading the form
>data1.recordsource = (find all record for the current projectid)

>and data2 is only used to populate the combo box, then I do a
>data1.edit
>data1.recorset.fields("Name").value = combo1
>data1.refresh

>data1.movenext
>data1.moveprevious



Tue, 19 May 1998 03:00:00 GMT  
 AddNew DON'T work, Need HELP!!!

Quote:

> Path:

news.pi.net!news.sara.nl!news.nic.surfnet.nl!howland.reston.ans.net!gatech2!news.sprintlin
k.net!news.cc.sunysb.edu!engws12!ghauser
Quote:

> Newsgroups: comp.lang.basic.visual.database
> Subject: AddNew DON'T work, Need HELP!!!
> Date: 30 Nov 1995 17:39:40 GMT
> Organization: State University of New York at Stony Brook
> Lines: 62

> NNTP-Posting-Host: engws12.cc.sunysb.edu
> X-Newsreader: TIN [version 1.2 PL2]

> Hi there!

>    I have a problem that I can't figure out... it theory it is a very
> simple procedure. I want to add a new record to a table named "Changes".

> from VB I have to data controls data1, data2 on the same form.

> Data1 is the one connected to the the table "changes" data2 is connected to the
> table "Files"

> Now, when a user wants to add a record, a change, In order to validate the
> file name, I have a combo box (data2) that lists the valid file names
> in the table files <- data2. This is to avoid user error when they enter the
> data.

> So I have a button called "change name" that lists the valid field names,
> by populating the combobox.

> So far so good... now, after they clicked the AddNew button (data1.AddNew),
> The only 3 buttons available are cancel, update (to save the record) and
> change field name. So they are supposed to go select the name of the file from
> the combobox, and  enter information about the changes made to the file.

> Then when all is done they are supposed to click Update to save the records.

> The PROBLEM is... IT IS NOT ADDING A NEW RECORD! It OVER writes the record
> that was there...

> So I only have one record at any time! Addnew, movenext moveprevious
> thats all that is should take no?

> Now, pehaps the fact that I have the following upon loading the form
> data1.recordsource = (find all record for the current projectid)

> and data2 is only used to populate the combo box, then I do a
> data1.edit
> data1.recorset.fields("Name").value = combo1
> data1.refresh

> data1.movenext
> data1.moveprevious

> Why isn't adding the record? is data1 pointer not moving at all?
> Do you think this comes from setting data to the recordsource query, I don't
> think so, since I do the same on a similar form and I can still addnew and
> delete records.

> I am stuck good! In fact i don't think that the name field is geting updated
> when I say ....("name").value = combo1.

> Arrghhhh!!!

> Any suggestions? If you need more info I will be more than glad to
> send the code.

> Thanks a million.

> George

Hello George,

When you're calling data1. edit you're actually giving the command to edit the current
record....

You should use the following:

Data1.AddNew
'Your code for handling user input
Data1.Update

Any other option like data1.refresh should be called after updating the new record...

Hope this helps ...

Gerrit (Dutch for George !)



Sun, 24 May 1998 03:00:00 GMT  
 AddNew DON'T work, Need HELP!!!

says...
Quote:


>: Hi

>: Shouldn't it be Data1.recordset.addnew or did you just forget to write

the recordset. the same
Quote:
>: goes for the rest.

>: Data1.recordset.movefirst
>: Data1.recordset.movelast
>: andsoon

>: Hope this helps

>: Anders


>: >
>: >The PROBLEM is... IT IS NOT ADDING A NEW RECORD! It OVER writes the
record
>: >that was there...
>: >
>: >
>: >So I only have one record at any time! Addnew, movenext moveprevious
>: >thats all that is should take no?
>: >
>: >Now, pehaps the fact that I have the following upon loading the form
>: >data1.recordsource = (find all record for the current projectid)
>: >
>: >and data2 is only used to populate the combo box, then I do a
>: >data1.edit
>: >data1.recorset.fields("Name").value = combo1
>: >data1.refresh
>: >
>: >data1.movenext
>: >data1.moveprevious
>: >

>No...

>Now the whole program does not work.... I wonder if it is a database error.

>Sometimes when I try to open the access table it does not work.

>SUCKS!

The following code works for me when I add a new record.
  data1.recordsource.addnew
  data1.recordsource("Name") = "John Doe"
  data1.recordsource.update
' if you move around in the database and want to go back to this record
  data1.recordsource.bookmark = data1.recordsource.lastmodified
I think the problem is that when you invoke Edit, it throws away the empty
record created with the AddNew. Therefore, you end up editing the current
record.
Hope this helps.
BM


Wed, 27 May 1998 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Do's and Don'ts of UpdateBatch and Disconnected Recordsets

2. ***Default value don't work with AddNew-Upadte

3. ***Default value don't work with AddNew-Upadte

4. ***Default value don't work with AddNew-Upadte

5. MovePrevious don't work but the MoveNext work's fine

6. good i'ts working!

7. I've programmed a game that don't work Help

8. Help? QueryDef parameters don't work

9. Help files don't work after running procedure

10. Script works, script don't work

11. Help! Scrollbars Don't Work

12. HELP! ListBox Don't work

 

 
Powered by phpBB® Forum Software