Copy and Paste Unbound Text Box "Data" to Field On New Record

fenhow

Registered User.
Local time
Today, 01:31
Joined
Jul 21, 2004
Messages
599
Hi,

I have a form that runs a search on an existing database. The end user types in a VIN number and if there is a match I am okay, the issue is if there is No Match I want to create a New Record on another form and carry the VIN they typed on the search form into the new record without having to retype it..

I can get as far as No Match, Open Form, Create New Record but I dont know how to copy and paste the text in the appropiate field..

Any help is greatly appreciated..

Fen How
 
Hi,
If new records are only being created this way you could have the default value for new records point to the value in your search form?!
Might work.
 
So you gotta search form that searches for a ViN Number. Then I assume this is attached to an IF statement saying something along the lines of:
IF VIN doesnt exist Then
Open form, populate this text box with the VIN blah blah...

then you need the user to fill out other details on the form? or are you badass and have it search the DVLA database? not that i know how easy/hard it is to gain access to that db...

Anyways im guessing you want the user to fill out the form and then insert these values into a table via use of a button or some other control?

1) Add validation so that all txt boxes are not Null. (Nice and easy can be done by a bunch of If, Then, Else statements.

2) Then On-Event i.e. On button click or whatever your control is.. turn the user inputs into strings: Me!txtName.Value = strName

3) This then executes and insert sql statement:

Code:
strSQL = "INSERT INTO yourtablename ( Name, Value2, Value3 ) VALUES ('" & strName & "', " & otherstring(Number) & ", '" & otherstring(Text) & "')
CurrentDb.Execute

Hard to help without a better explanation of your db/form process...
 

Users who are viewing this thread

Back
Top Bottom