|
-
Jul 15th, 2000, 10:06 PM
#1
Thread Starter
Addicted Member
How can i add new records using DAO without making it confusing for the user?
Reality is an illusion caused by by lack of drugs
Is this real or am i just having a dream?
-
Jul 15th, 2000, 10:46 PM
#2
Hyperactive Member
Could you be a little more specific about what you want to let the end-user do? And/or define what it is about your current method that you understand is confusing. If you know the table, fields you intend letting the end-user insert, it's one thing; but if you are trying to allow the end-user to input SQL directly, it's another. With better def, I would be happy to give you my two cents worth
-
Jul 15th, 2000, 10:53 PM
#3
Thread Starter
Addicted Member
i know the fields and the table all that the end user has to do is enter the info. See thread http://forums.vb-world.net/showthrea...threadid=23036 for specifics
Reality is an illusion caused by by lack of drugs
Is this real or am i just having a dream?
-
Jul 16th, 2000, 12:01 AM
#4
Hyperactive Member
Sorry for the delay in responding, I got sidetracked.
It doesn't have to be much more exotic than something like this:
Code:
Sub AddNewRec_Click()
Dim SQL$, db as database
On Error Goto Oops
' when textbox values are error free
SQL$ = "INSERT <table_name>(<field1_name>, <field2_name>)VALUES('" & tb1_str & "', " tb2_int & ")"
Set db = OpenDatabase(<yourdatabase>)
db.execute SQL$
Set db = Nothing
' refresh supporting data form/object, as necessary, to show new data
' since end-user "sees" none of this, maybe add msgbox saying life is good
Exit Sub
Oops:
' maybe say the wheels flew off..
End Sub
* pesky smiley faces, always forget to uncheck that box...
And my SERIOUS headspace-timing being out of sync isn't helping either...
[Edited by Mongo on 07-16-2000 at 01:35 AM]
-
Jul 16th, 2000, 12:11 AM
#5
Thread Starter
Addicted Member

in the line SQL$ etc..where it says tb1_str and tb2_int can i put text boxes eg txtband.text instead?
Reality is an illusion caused by by lack of drugs
Is this real or am i just having a dream?
-
Jul 16th, 2000, 12:16 AM
#6
Hyperactive Member
Yes. Sorry I got too short in my shorthand naming. I was trying to imply a textbox.text value that is supposed to be a string with tb1_str (note the extra tick marks on each side) and an integer datatype with tb2_int.
-
Jul 16th, 2000, 12:26 AM
#7
Thread Starter
Addicted Member
-
Jul 16th, 2000, 12:32 AM
#8
Hyperactive Member
Jimminey Cricket, I am running on empty. Yes! When you are not including ALL table def fields in your insert or they are out of order, you must specify the field names.
And I meant the <> as generic signifiers, you DO NOT include them.
INSERT table_name(fieldA_name,fieldB_name)VALUES("IF DOPE USE ODD", 1)
[Edited by Mongo on 07-16-2000 at 01:37 AM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|