lmerrell
asked on
Want to copy existing record - VB/Access
Hello all!
I have an application with a VB6 front-end and an Access 97 back-end. The primary table in the database is a general information Group table. The Primary Key for the table is GroupNo. I am looking for the best method to copy an existing record to a new record with the same GroupNo concatenated with a designated suffix. This is quite easy entirely within Access using Insert SQL. What is the best way in VB?
Thanks,
Guido
I have an application with a VB6 front-end and an Access 97 back-end. The primary table in the database is a general information Group table. The Primary Key for the table is GroupNo. I am looking for the best method to copy an existing record to a new record with the same GroupNo concatenated with a designated suffix. This is quite easy entirely within Access using Insert SQL. What is the best way in VB?
Thanks,
Guido
also use SQL...VB supports it....and since you used it in Access before, it should be easy for you......the syntax is exactly the same..you just need some general declarations before you issue SQL statements...contact me if you need the declaration codes...
ASKER
Suppose I had a form with a combo box to select an existing GroupNo and a textbox for entry of the suffix. I can build the sql to reference these controls with know problem. Could you give me some example code to execute it. I'm feeling real lazy today. :-)
thanks,
Guido
thanks,
Guido
ASKER
I meant "with no problem." I had three people talking to me while I was typing my response.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
by the way.."UnloadAll" is a function I wrote....it's not internal to VB....if you want the code (it's only a few lines)..msg me...
ASKER
st_steve -
I was hoping to use an action query instead of doing this using a recordset through code.
What about using an Execute method?
mySQL = "INSERT INTO tblGroupStatic blah blah blah"
Set db = OpenDatabase(App.Path & DBName)
db.Execute mySQL
does this look right?
I was hoping to use an action query instead of doing this using a recordset through code.
What about using an Execute method?
mySQL = "INSERT INTO tblGroupStatic blah blah blah"
Set db = OpenDatabase(App.Path & DBName)
db.Execute mySQL
does this look right?
st_steve:
You forgot to declare the type for lstSession since this is not a native VB type.
You forgot to declare the type for lstSession since this is not a native VB type.
ASKER
st_steve - FYI, the execute method does work. In fact it works quite well. I'm feeling generous and you did joustle me into thinking so...
Thanks
Thanks
"johnny6"....lstSession is a listbox to display the status of my program..other than that..it has no connection with DB or Access....
"lmerrell"..glad I can help :)
"lmerrell"..glad I can help :)