all I have this code that opens a table and fills in a blank field from the previous record.
Private Sub CopyField_click()
'Fill blank fields with previous record
Dim i As String
Set myDb = CurrentDb()
Set MyRs = myDb.OpenRecordset("ACHClosedAccts")
MyRs.MoveFirst
Do While Not MyRs.EOF
MyRs.Edit
For Each myfld In MyRs.Fields
If myfld.Name = "ClientNo" Then
If MyRs(myfld.Name).Value <> "" Then
i = MyRs(myfld.Name).Value
Else
MyRs(myfld.Name).Value = i
MyRs.Update
End If
End If
Next myfld
MyRs.MoveNext
Loop
End Sub
I need to use this code with multiple field names Where
myfld.name = "ClientNo"
I need it to also reference another field to do the same thing. Like:
myfld.name = "ClientNo" and "AcctNo"
It won't work with "And" or "Or". What can I do? I thought about an array but I don't know how to rewrite the code unsing an array.
Please help Thanks
In my database i have a field called product code which the user enters the code as T0001, T0002, T0003 and so on for each record.
would it be possible when adding a new record for that field to auto fill the product code as T0004 for example, so the user doesnt have to type the code in all the time.
Works great, but when I hit the number "3", (3 times in row) it will let me into the form. I want it to not let me in IF I don't know the password.
Where did I go wrong?
Private Sub Form_Load() Dim pw As Variant
If InputBox("What is the password?", "Password") = "1" Then Else MsgBox "Invalid Password", vbCritical, "Sorry Charlie" DoCmd.Close If InputBox("What is the password?", "Password") = "2" Then Else MsgBox "Invalid Password", vbCritical, "Sorry Charlie" DoCmd.Close End If End If
I protect my code from people being able to read it by setting a password on the code from Tools > Properties, selecting the Protection tab and entering a password, and clicking "Lock Project"
Is there a way to write code that will remove that Lock Project check and check it back on?
I've looked through the Application.SetOption command and it doesn't seem to be one of the choices. It would be very helpful if someone knew how to do this.
Hi, I got a Date field[Provdate-ontv] which only is allowed to set if another field, a Yes/No field[Prov-ontv] is set to Yes (default is no) How do I do that ??
I've tried googling this, but I can't find anything helpful. I have five columns in my 'Main' table. In each row, column B, C & D are solely dependant on column A. And column E is completely independant of all of them. I want to be able to select a choice in column A using a drop-down menu (which I know how to do) and have columns B, C, & D automatically fill themselves in (which I don't know how to do). Column E I would just manually enter.
How do I get columns B, C, & D to automatically fill themselves in my 'Main' table. I would select a value from a drop-down menu in column A and want everything else to fill in. The values for A,B,C,& D are all in seperate tables with an ID and linked to their respective fields in the 'Main' table. Appreciate any help.
I am looking to find the experssion that will allow me to put a date in a query under date completed and have it fill another field for schedule.
I know that in Excel it would be =sum(A1 +90 ) and this will give a date 90 days after the date inputed into field A1 and so on down the column. and it would auto fill the next column for me
I'm new to access and i need help in filling a certain field with the same value. In fact i have data representing one quarter of data and i need to add a column called "Quarter" in which i paste the same value: the current quarter : "Q4".
How can i do that? I think this is a real simple issue.
in these 3 columns i have different values and in two fo these columns there are blanks. I want to search for this blanks and fill them in with a static value. But only the two columns. How can i do this? Update Queries?
I have created a form with one unbound textbox and a command button.
How do I make sure that the query only runs if text is entered in the textbox? I do not want the command button to run unless the textbox has data to query.
At the moment the Query runs and displays all records.
Hi Newbie to your forum and a bit of a novice in access too.
I am building a db and a form that was previously able to be filled. When I altered the form and added some fields from a different table now just dings when I try to type in any of the old fields, but I can enter new data into the new field from the second table any ideas whats gone wrong.
I have searched through the properties and compared the new to old fields and can't really find any discrepency between the two.
Would it help if I posted the mdf file? (its only tiny) Cheers Mike
I have an access database with information that is posted to through a form. On the form I have a dropdown box with a list. After choosing an options I want a text box to auto fill from data in a separate table in the same access file. I have been trying different things for about a week, and I have done alot of reading.
I have a subform and when the controls on it are updated, changed from previous info, then I need a control(called dtmUpdate) to show the current date (=Date()).
I have an order form that requires me to change the current promotion we're running continually. I need to populate all rows based on the update changes of one textbox. Is this possible? Right now when I update the promotion text box, it only updates the text for row one.
First of all there is a table called "tblParTeam" wich contain the teamname and ID of teams partissepating in a certain Tournament. The tournemant data is kept in the table tblTournament.
Each tournament contains a couple of variables: "Number of teams per tournament", "Number of Rounds" wich reside in the tblTournament.
Here is the thing. I also have a form based on the tblTournament. Each tournament had a number of partisipating teams (stored in the variable "Number of teams per tournament"). Then I have a table called tblTournamentDetail wich containt the Tournament_ID, TeamPro_ID (looks in the table "tblParTeam"), TeamContra (also looks in "tblParTeam").
When I pusch a button on my form, wich is based on the tblTournament, tblParTeams and tblTournamentDetail, I would like the X (Number) of particepating teams to be filled in randomly in the tblTournamentDetail.
Lets say I have 10 teams I want 5 to be filled in randomly in the TeamPro_ID and 5 in the TeamContra_ID. How do I go about this?
hi. this might be simple for others but i'm new with access. how can i automatically fill a YES/NO field referring to a Text field. which means, if the field is EMPTY, it will automatically say "No or False" in the Yes/No field, or vice versa.
thank you people of great minds and kind heart. more power to you all.
I am trying to write a database that has one table for companies and another for the services they hire.
The objective is to end up with a managable excel sheet that imoprt into an accountancy package. (Using Acess to eliminate several sheets in current procedure and also free up 1.5 days PCM data entry time).
I have set an auto look up that will autofill the required fields into the form ( =MYQUERY.column(1) ). This works fine and does what i need it to. My problem is that it does not write back to the table so I can not run an outputto command.
I do not know of any other way to produce the autofill to try another way. I have looked at the setup and can not find any problems.
I have two tables in the same Access 2003 database.
Table1 is called "Clients" and has address type fields, e.g. street_name, postcode, etc. It also has a field called CYPAN_area.
Table 2 is called CYPAN_Postcodes and has two fields; postcodes and the CYPAN area that postcode belongs to.
I want to create a function so that when someone enters the postcode in table1, the database searches Table2 and identifies which CYPAN area that postcode belongs to and automatically populates the "CYPAN_area" field in Table 1.
any tips greatly appreciated
Harry
PS I'm only a novice so I don't know anything about VBA etc, but I understand excel type formula
I am trying to make a courses registration database. I have 3 tables; tblContacts [ContactID], [FitstName], [LastName] [Etc..] [Etc..] tblCourseRegistration [RegID], [ContactID] [CourseID] and tblCourses [CourseID], [RegID], [CourseName], [StartDate], [AvailablePlaces] I have created a form called Test1 that displays The CourseID, CourseName, StartDate EndDate and an unbound textbox called PlacesLeft. I would like to display in this text box the number of places that are still available on a particular course. I've written a querie that counts the CourseID's in the course registration table this works ok but I want it to place the value in the PlacesLeft text box. Then I can do a simple calculation based on the PlacesAvailable textbox. Anyone any idea how to do this My querie reads SELECT Count([CourseID]) FROM tblCourseRegistration WHERE (((tblCourseRegistration.CourseID)=(Forms.Test1.Co urseID)));
I tried another method which includes a command button that when clicked tries to run the following Dim MyRS As ADODB.Recordset, strSQL As String
Set MyRS = New ADODB.Recordset strSQL = "SELECT Count([CourseID])FROM tblCourseRegistration WHERE (((tblCourseRegistration.CourseID) = (Forms.Test1.IDNo)))" MyRS.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If MyRS.NoMatch Then Me.PlacesLeft = "" Else Me.PlacesLeft = MyRS.Fields(0) but Access (Ver 2000) does not like the noMatch and shows it as an error. I would be very grateful if someone could show me how to sort this out!
Hello, I have a record set I open with SQL, and I have lots of fields that are assigned control source names (which are columns in my table) When I open the record set from a table, science the control source names agree is there a way I can fill all those out instead of going: Me!fieldOne = myrecordset("fieldOne") Me!fieldTwo = myrecordset("fieldTwo") etc etc
That is very tedious and very hard to update the code. Is there a way?
Alright, I've tried just about everything else, now I need to tap into the grapevine for some help. I've read every thread about auto pop info, DLookUP and auto fill. I'm so lost and confused. I'm an Access 97 beginner and can't seem to get my form to do the things I need. I'm working with an existing form and trying to get text fields to auto fill with an "After Update" command. I'm not familiar with VB coding and the function isn't working. If someone out there can help me, I'd really appreciate it.